Advertisments

C Program To Get Out Whether A Given String Is An Identifier Or No longer

C program to derive out whether a given string is an identifier or now now not.
A string is named an identifier when he follows these rules:

  • The most important letter ought to be alphabet(every capital or minute i.e. A-Z,a-z) or underscore(_).
  • After first letter it comprises sequence of alphabet or digits(0-9) or underscore(_) but now now not like any special symbol(#,@,$,%,^,& and so forth.) and house( ).

Recommended:  Java programming (inexperienced persons)

#embody
#embody
#embody
vital (){ //code by techbytebox.com
char string [50];
printf (“Enter impress to be identified: “);
scanf (“%s”, string);
int length = strlen (string) – 1;
bool alpha_string = unfounded;
if ( string [0] >= ‘A’ && string [0] <= 'Z' )
alpha_string = true;
if ( string [0] >= ‘a’ && string [0] <= 'z' )
alpha_string = right;
bool underScore = right;
if ( string [length] == ‘_’ )
underScore = unfounded;
int num = 0;
for ( int i = 1; i <= length; i++ ) {
if ( string [i] == ‘_’ )
num++;
else
num = 0;
if ( num == 2 ) {
underScore = unfounded;
destroy;
}}
if ( alpha_string && underScore)
printf (“Answer: %s is a sound identifiern”, string);
else
printf (“Answer: %s is now now not a sound identifiern”, string);
getche();
} //code by Afolabi Achiever (techbytebox)

Recommended: Complete Manual on How to install Xampp
I am hoping your C Program compiles with out error?? if that is the case ample drop a commentary and we can be cosy to allow you out, else part this online page alongside with your programming guests thru any of the social media listed below.
Post a Comment (0)
Previous Post Next Post
Jobs Alert To Get Latest Jobs Alerts
Join Our Facebook Page Join Over Facebook Page To Lastest Jobs Update And Notification