Advertisement
palash25

pass1

Apr 28th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main (void)
  5. {
  6.     char name[8][8],value[8][4];
  7.     int i,j,l,len,k=0,val=-4,m=0;
  8.     char l1[8][6],l4[8][6];
  9.     int l2[8],l3[8];
  10.     char c1[8][6]={{"ABCD"},{"NULL"},{"NULL"},{"NULL"},{"NULL"},{"FOUR"},{"TEMP"},{"NULL"}};
  11.     char c2[8][6]={{"START"},{"USING"},{"L"},{"A"},{"ST"},{"DC"},{"DC"},{"END"}};
  12.     char c3[8][6]={{"0"},{"*"},{"1"},{"1"},{"1"},{"F4"},{"1F"},{"NULL"}};
  13.     char c4[8][6]={{"NULL"},{"15"},{"FOUR"},{"=F5"},{"TEMP"},{"NULL"},{"NULL"},{"NULL"}};
  14.     char mot[8][8]={"L","ST","A"};
  15.     for(i=0;i<8;i++)
  16.     {
  17.         printf("%s%s%s%s%s%s%s%s",c1[i],"\t",c2[i],"\t",c3[i],"\t",c4[i],"\n");
  18.     }
  19.     for(i=0;i<8;i++)
  20.     {
  21.         for(m=0;m<3;m++)
  22.         {
  23.             if(strcmp(c2[i],mot[m])==0||strcmp(c2[i],"DC")==0)
  24.             {
  25.                 val+=4;
  26.                 break;
  27.             }
  28.         }
  29.         if(strcmp(c1[i],"NULL")!=0)
  30.         {
  31.             strcpy(l1[k],c1[i]);
  32.             l2[k]=val;
  33.             k++;   
  34.         }
  35.     }
  36.     printf("Symbol Table");
  37.     printf("\n\n\n");
  38.     for(i=0;i<k;i++)
  39.     {
  40.         if(l2[i]==-4)
  41.             l2[i]=0;
  42.         printf("%s\t%d\t\n\n",l1[i],l2[i]);
  43.     }
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement