Advertisments

C Program To Obtain Out Whether or now not A Given String Is An Identifier Or Now not

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

  • The most crucial letter should always be alphabet(every capital or shrimp 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 include any particular symbol(#,@,$,%,^,& etc.) and space( ).

Suggested:  Java programming (inexperienced persons)

#consist of
#consist of
#consist of
most crucial (){ //code by techbytebox.com
char string [50];
printf (“Enter designate to be known: “);
scanf (“%s”, string);
int length = 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 = real;
bool underScore = real;
if ( string [length] == ‘_’ )
underScore = unfounded;
int num = 0;
for ( int i = 1; i <= length; i++ ) {
if ( string [i] == ‘_’ )
num++;
else
num = 0;
if ( num == 2 ) {
underScore = unfounded;
fracture;
}}
if ( alpha_string && underScore)
printf (“Resolution: %s is a satisfactory identifiern”, string);
else
printf (“Resolution: %s is now not a satisfactory identifiern”, string);
getche();
} //code by Afolabi Achiever (techbytebox)

Suggested: Full Files on How to install Xampp
I’m hoping your C Program compiles with out error?? if that is the case favorable drop a relate and we are in a position to be ecstatic to can enable you to out, else fragment this online page with your programming chums by 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