Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

//Implementation : Program to check the identifier in the given source program

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char *a[10],b[10] ;
int i,j,p,flag=0;
//a[]={"if","else","main","void" ,"char","float","goto","for","include","int"};
a[0]="if";
a[1]="else";
a[2]="main";
a[3]="void";
a[4]="char";
a[5]="float";
a[6]="goto";
a[7]="for";
a[8]="include";
a[9]="int";
clrscr() ;
gets(b) ;
for(i=0;i<10;i++)
{
p=strcmp(b,a[i]);
if(p==0)
{
flag=1;
break ;
}}
if(flag==1)
{printf( "keyword matched" ) ;
}
else
{printf("keyword not matched" ) ;
}
getch( ) ;
}

You might also like