Advertisments

C Program To Rating 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 is assumed as an identifier when he follows these principles:

  • The first letter must silent be alphabet(every 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 non-public any particular symbol(#,@,$,%,^,& and heaps others.) and situation( ).

Suggested:  Java programming (newbies)

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

Suggested: Total E-book on The vogue to set up Xampp
I hope your C Program compiles without error?? if that is the case good tumble a commentary and we are going to offer you the choice to be gratified to permit you to out, else part this page with your programming chums by any of the social media listed beneath.
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