C Program To Find Out Whether A Given String Is An Identifier Or Not

C program to find out whether a given string is an identifier or not. A string is called an identifier when he follows these rules:

C program to find out whether a given string is an identifier or not.
A string is called an identifier when he follows these rules:
  • The first letter must be alphabet(both capital or small i.e. A-Z,a-z) or underscore(_).
  • After first letter it contains sequence of alphabet or digits(0-9) or underscore(_) but not contain any special symbol(#,@,$,%,^,& etc.) and space( ).
Recommended: Java programming (beginners)
#include <stdio.h>
#include <string.h>
#include <conio.h>
main (){ //code by techbytebox.com
char string [50];
printf ("Enter value to be identified: ");
scanf ("%s", string);
int length = 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 = true;
bool underScore = true;
if ( string [length] == '_' )
underScore = false;
int num = 0;
for ( int i = 1; i <= length; i++ ) {
if ( string [i] == '_' )
num++;
else
num = 0;
if ( num == 2 ) {
underScore = false;
break;
}}
if ( alpha_string && underScore)
printf ("Answer: %s is a valid identifier\n", string);
else
printf ("Answer: %s is not a valid identifier\n", string);
getche();
} //code by Afolabi Achiever (techbytebox)
Recommended: Complete Guide on How to install Xampp
I hope your C Program compiles without error?? if so kindly drop a comment and we will be glad to help you out, else share this page with your programming friends through any of the social media listed below.

COMMENTS

BLOGGER
Name

AdSense,1,affiliate marketing,8,Airtel,3,Amazon,1,Android,10,BEST BATTLE ROYALE GAMES,1,BEST BATTLE ROYALE GAMES FOR ANDROID,1,Best cryptocurrency exchanges,1,Best Cryptocurrency Exchanges In Nigeria,1,Blogger Blogspot,2,Blogging Tips,27,BournFactor,1,Coding Tutorials,3,Foto,1,Gaming,6,GLO,1,GLO 22X PLAN,1,GLO 22X PLAN ELIGIBILITY,1,GLO 22X PLAN SUBSCRIPTION CODE,1,How to,27,HOW TO CHECK NIN,1,HOW TO CHECK NIN ON 9MOBILE,1,HOW TO CHECK NIN ON AIRTEL,1,HOW TO CHECK NIN ON GLO,1,HOW TO CHECK NIN ON MTN,1,How to make money,6,How To Make Money on Fiverr,1,Icon,1,income program,3,LifeStyle,4,LPV Forum,2,Make Money on Fiverr,1,Microsoft,1,Mobile,15,MTN,1,NIMC Registration Centers,1,NIN Registration Centers,1,OPPO,1,Piggyvest,1,POPULAR BATTLE ROYALE GAMES,1,POPULAR BATTLE ROYALE GAMES FOR ANDROID,1,Programming,2,Redmi,1,Scholarship,3,Talent Competition,1,Tech_News,26,Top 10 crypto exchanges,1,TOP BATTLE ROYALE GAMES,1,Twitter,1,WhatsApp,1,Windows 10,2,Windows 7,2,Windows 8,2,Windows XP,2,Xiaomi,1,Youtube,2,
ltr
item
TechByteBox - OneStop Blog For Techies: C Program To Find Out Whether A Given String Is An Identifier Or Not
C Program To Find Out Whether A Given String Is An Identifier Or Not
C program to find out whether a given string is an identifier or not. A string is called an identifier when he follows these rules:
TechByteBox - OneStop Blog For Techies
https://www.techbytebox.com/2020/02/c-program-to-check-whether-given-string-is-an-identifier-or-not.html
https://www.techbytebox.com/
https://www.techbytebox.com/
https://www.techbytebox.com/2020/02/c-program-to-check-whether-given-string-is-an-identifier-or-not.html
true
3784260122479626043
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy