How can i count the number of symbols found in C-code in filex.c ??
eg:
Code:
while 1
( 3
) 3
} 1
{ 1
; 2
!= 1
++ 1
identifiers 8 (c, getchar, EOF, sentence, i, etc)
= 3
[ 2
] 2
char const 1 ('\0')
Code:
//filex.c
while(( c = getchar()) != EOF){
sentence[i++] = c;
}
sentence[i] = '\0';
With the code bellow, i have split the c-code into tokens which will be
Code:
while((
c
=
getchar())
!=
EOF){
sentence[i++]
=
c;
}
sentence[i]
=
'\0';
From here how can i go further to identify what is the content of the token ??
Code:
fscanf(cfPtr, "%s", xyz);
while(!feof(cfPtr)){
processinfo(xyz);
fscanf(cfPtr, "%s", xyz);
}
fclose(cfPtr);
}