C Program To Obtain Out Whether A Given String Is An Identifier Or No longer

C program to search out out whether a given string is an identifier or no longer.
A string is thought as an identifier when he follows these rules:

  • The principle letter has to be alphabet(both capital or little i.e. A-Z,a-z) or underscore(_).
  • After first letter it contains sequence of alphabet or digits(0-9) or underscore(_) however no longer absorb any special image(#,@,$,%,^,& etc.) and region( ).

Suggested:  Java programming (inexperienced persons)

main (){ //code by
char string [50];
printf (“Enter price to be diagnosed: “);
scanf (“%s”, string);
int dimension = strlen (string) – 1;
bool alpha_string = spurious;
if ( string [0] >= ‘A’ && string [0] <= 'Z' )
alpha_string = true;
if ( string [0] >= ‘a’ && string [0] <= 'z' )
alpha_string = appropriate;
bool underScore = appropriate;
if ( string [length] == ‘_’ )
underScore = spurious;
int num = 0;
for ( int i = 1; i <= dimension; i++ ) {
if ( string [i] == ‘_’ )
num = 0;
if ( num == 2 ) {
underScore = spurious;
if ( alpha_string && underScore)
printf (“Answer: %s is a safe identifiern”, string);
printf (“Answer: %s is no longer a safe identifiern”, string);
} //code by Afolabi Achiever (techbytebox)

Suggested: Total Files on set up Xampp
I am hoping your C Program compiles without error?? if that is the case profitable topple a comment and we can appreciate to can uncover you how to out, else part this page with your programming chums thru 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