C program to safe out whether or no longer a given string is an identifier or no longer.
A string is believed as an identifier when he follows these suggestions:
- The first letter should always 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 possess any special symbol(#,@,$,%,^,& and so on.) and space( ).
Commended: Java programming (novices)
#encompass
#encompass
#encompass
major (){ //code by techbytebox.com
char string [50];
printf (“Enter designate to be identified: “);
scanf (“%s”, string);
int length = strlen (string) – 1;
bool alpha_string = faux;
if ( string [0] >= ‘A’ && string [0] <= 'Z' )
alpha_string = true;
if ( string [0] >= ‘a’ && string [0] <= 'z' )
alpha_string = correct;
bool underScore = correct;
if ( string [length] == ‘_’ )
underScore = faux;
int num = 0;
for ( int i = 1; i <= length; i++ ) {
if ( string [i] == ‘_’ )
num++;
else
num = 0;
if ( num == 2 ) {
underScore = faux;
destroy;
}}
if ( alpha_string && underScore)
printf (“Resolution: %s is a official identifiern”, string);
else
printf (“Resolution: %s is no longer a official identifiern”, string);
getche();
} //code by Afolabi Achiever (techbytebox)
I’m hoping your C Program compiles with out error?? if that’s the case edifying drop a assert and we are in a position to be happy to permit you out, else share this page with your programming pals by any of the social media listed beneath.