C program to search out out whether or now now not a given string is an identifier or now now not.
A string is known as an identifier when he follows these solutions:
- The first letter might well well honest quiet be alphabet(each capital or little i.e. A-Z,a-z) or underscore(_).
- After first letter it incorporates sequence of alphabet or digits(0-9) or underscore(_) but now now not occupy any special image(#,@,$,%,^,& etc.) and utter( ).
Quick: Java programming (newbies)
#encompass
#encompass
#encompass
essential (){ //code by techbytebox.com
char string [50];
printf (“Enter worth to be acknowledged: “);
scanf (“%s”, string);
int measurement = 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 = correct;
bool underScore = correct;
if ( string [length] == ‘_’ )
underScore = false;
int num = 0;
for ( int i = 1; i <= measurement; i++ ) {
if ( string [i] == ‘_’ )
num++;
else
num = 0;
if ( num == 2 ) {
underScore = false;
shatter;
}}
if ( alpha_string && underScore)
printf (“Solution: %s is a sound identifiern”, string);
else
printf (“Solution: %s is now now not a sound identifiern”, string);
getche();
} //code by Afolabi Achiever (techbytebox)
I’m hoping your C Program compiles without error?? if that is the case constructive topple a comment and we are going to probably be jubilant to can enable you to out, else share this online page with your programming chums thru any of the social media listed below.