Advertisments

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

C program to hunt down out whether or now not a given string is an identifier or now not.
A string is called an identifier when he follows these principles:

  • The first letter must be alphabet(both capital or small i.e. A-Z,a-z) or underscore(_).
  • After first letter it contains sequence of alphabet or digits(0-9) or underscore(_) nonetheless now not comprise any particular image(#,@,$,%,^,& etc.) and dispute( ).

Instructed:  Java programming (rookies)

#embody
#embody
#embody
main (){ //code by techbytebox.com
char string [50];
printf (“Enter mark to be acknowledged: “);
scanf (“%s”, string);
int size = strlen (string) – 1;
bool alpha_string = spurious;
if ( string [0] >= ‘A’ && string [0] <= 'Z' )
alpha_string = true;
if ( string [0] >= ‘a’ && string [0] <= 'z' )
alpha_string = superior;
bool underScore = superior;
if ( string [length] == ‘_’ )
underScore = spurious;
int num = 0;
for ( int i = 1; i <= size; i++ ) {
if ( string [i] == ‘_’ )
num++;
else
num = 0;
if ( num == 2 ) {
underScore = spurious;
break;
}}
if ( alpha_string && underScore)
printf (“Acknowledge: %s is a legitimate identifiern”, string);
else
printf (“Acknowledge: %s is now not a legitimate identifiern”, string);
getche();
} //code by Afolabi Achiever (techbytebox)

Instructed: Full Recordsdata on Straightforward how one can set up Xampp
I am hoping your C Program compiles without error?? if that is the case good drop a comment and we are going to most seemingly be contented to enable you out, else piece this page along with your programming chums 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