Advertisments

C Program To Get Out Whether or no longer A Given String Is An Identifier Or Now not

C program to search out out whether a given string is an identifier or no longer.
A string is named an identifier when he follows these principles:

  • The critical letter wants to be alphabet(both capital or diminutive i.e. A-Z,a-z) or underscore(_).
  • After first letter it contains sequence of alphabet or digits(0-9) or underscore(_) but no longer have any particular symbol(#,@,$,%,^,& etc.) and set( ).

Suggested:  Java programming (beginners)

#encompass
#encompass
#encompass
critical (){ //code by techbytebox.com
char string [50];
printf (“Enter designate to be identified: “);
scanf (“%s”, string);
int length = strlen (string) – 1;
bool alpha_string = counterfeit;
if ( string [0] >= ‘A’ && string [0] <= 'Z' )
alpha_string = true;
if ( string [0] >= ‘a’ && string [0] <= 'z' )
alpha_string = correct;
bool underScore = correct;
if ( string [length] == ‘_’ )
underScore = counterfeit;
int num = 0;
for ( int i = 1; i <= length; i++ ) {
if ( string [i] == ‘_’ )
num++;
else
num = 0;
if ( num == 2 ) {
underScore = counterfeit;
damage;
}}
if ( alpha_string && underScore)
printf (“Retort: %s is a legit identifiern”, string);
else
printf (“Retort: %s is no longer a legit identifiern”, string);
getche();
} //code by Afolabi Achiever (techbytebox)

Suggested: Full Data on install Xampp
I am hoping your C Program compiles without error?? if that’s the case marvelous drop a comment and we are in a position to luxuriate in to help you out, else portion this page with your programming web site visitors 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