Advertisments

C Program To Safe Out Whether or now now not A Given String Is An Identifier Or Not

C program to get out whether a given string is an identifier or now now not.
A string is known as an identifier when he follows these tips:

  • The first letter ought to be alphabet(every capital or minute i.e. A-Z,a-z) or underscore(_).
  • After first letter it contains sequence of alphabet or digits(0-9) or underscore(_) but now now not like any particular image(#,@,$,%,^,& and loads others.) and condo( ).

Urged:  Java programming (newcomers)

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

Urged: Complete E book on Guidelines on how to set up Xampp
I’m hoping your C Program compiles without error?? if that is so capable topple a comment and we may perhaps perhaps well bask in to make it easier to out, else fragment this web sigh along with your programming pals by strategy of 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