Advertisments

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

C program to uncover whether a given string is an identifier or no longer.
A string is known as an identifier when he follows these rules:

  • The first letter would possibly perchance perchance well perchance maintain to be alphabet(both capital or slight 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 occupy any particular symbol(#,@,$,%,^,& etc.) and space( ).

Suggested:  Java programming (beginners)

#embody
#embody
#embody
foremost (){ //code by techbytebox.com
char string [50];
printf (“Enter cost to be identified: “);
scanf (“%s”, string);
int measurement = 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 = honest;
bool underScore = honest;
if ( string [length] == ‘_’ )
underScore = unfounded;
int num = 0;
for ( int i = 1; i <= measurement; i++ ) {
if ( string [i] == ‘_’ )
num++;
else
num = 0;
if ( num == 2 ) {
underScore = unfounded;
damage;
}}
if ( alpha_string && underScore)
printf (“Resolution: %s is a sound identifiern”, string);
else
printf (“Resolution: %s is no longer a sound identifiern”, string);
getche();
} //code by Afolabi Achiever (techbytebox)

Suggested: Total Manual on How to set up Xampp
I’m hoping your C Program compiles with out error?? if so apt plunge a comment and we are able to be at liberty to abet you out, else portion this internet page along with your programming company through any of the social media listed under.
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