"C" PROGRAM TO FIND WHETHER THE STRING IS KEYWORD, CONSTANT or NOT


https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJfShSmc4uzJ32B_Cnh6KDE7EeSGsUpqwnmXpsZMSrMSp0wjgo7gGWZu_JIDHC_zUiWwWkPBhm3Pz_vS0k-tjHPGbd4J7sxNkEVv5q-YbMtId0PtXLQqi2n_k4Dee10jKN6F-IOkz4Wqgg/s1600/c+and+c%252B%252B+meansofmine.jpgPROGRAM TO FIND WHETHER STRING IS A KEYWORD OR NOT


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,flag=0,m;
char s[5][10]={"if","else","goto","continue","return"},st[10];
clrscr();
printf("\n enter the string :");
gets(st);
for(i=0;i<5;i++)
{
m=strcmp(st,s[i]);
if(m==0)
flag=1;
}
if(flag==0)
printf("\n it is not a keyword");
else


printf("\n it is a keyword");

getch();
}




OUTPUT

enter the string :return it is a keyword
enter the string :hello it is  not a keyword

PROGRAM TO FIND WHETHER THE STRING IS CONSTANT OR NOT


#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
void main()
{
char str[10]; int len,a; clrscr();
printf("\n Input a string :");
gets(str); len=strlen(str); a=0; while(a<len)
{
if(isdigit(str[a]))
{
} 
else 
{

} 
}

a++;

printf(" It is not a Constant");
break;

if(a==len)
{
printf(" It is a Constant");
}
getch();
}

OUTPUT

Input a string :23
It is a Constant



Input a string :a_123
It is not a Constant
 

4 comments:

Anonymous said...

i want to make a program in c to find a header file in a given program .how can i do this.......
rehan

Unknown said...

orey goba pagilipodi roy neku jagratha ga unduu

Unknown said...

goba pagulidiii okay

Anonymous said...

mr.subhramanyam cotact me

Post a Comment