skip to main
|
skip to sidebar
The symbol table program is used to find the address of individual characters,numeric,special characters.Simplest symbol table data structure in C language program is give below:
void main()
{
int i,len;
char e[20];
clrscr();
printf("\nEnter the expression:" );
scanf("%s",e);
len=strlen(e);
if(e[1]!='=')
{
printf("\nThe given expression is wrong");
printf("\nassignment is not possible");
getch();
exit(0);
}
printf("\nSYMBOL TABLE");
printf("\nSYMBOL\tADDRESS\tTYPE");
for(i=0;i</LEN;I++)>
{
if(isdigit(e[i]))
printf("\n%c\t%u\tCONSTANT",e[i],e[i]);
if(isalpha(e[i]))
{
printf("\n%c\t%u\tIDENTIFIER",e[i],e[i]);
}
}
getch();
}
NOTE:
- This program using header files are string.h,stdlib.h,ctype.h
- isalpha() is a one of the primary function.This is used to find the alphabetic characters.
- isdigit() is a member function of ctype.h.This is used to find the numbers.
You may also like:
{ 0 comments ... read them below or add one }
Post a Comment