2,878 views
1 votes
1 votes
Find no of Tokens in bellow program
int main()
{   a=b+c;
"printf("%d%d%d,a,b,c")";
}

nd my other doubt is if we replace a=b+c to "a=b+c or a=b+c" will it give lexical error nd if ,then  in which case.

2 Answers

Best answer
12 votes
12 votes

[1. int]   [2.main]  [3.( ]   [4.) ]  [5. { ]  [6. a ]   [7.= ]  [8. b ]   [9.+ ]  [10.c ]  [11. ; ] [12. "printf(" ] [13. % ]  [14. d ] [15. % ] [16. d ][17.% ]  [18.d ]  [19., ]  [20.a ]   [ 21., ] [22. b ]  [23. , ]  [24.c ]    [25.")" ]  [26. ; ]  [27. } ]

when 1st " come it search for next " when it found considered as token.

selected by

Related questions

4 votes
4 votes
2 answers
1
2 votes
2 votes
2 answers
2
Na462 asked Nov 7, 2018
3,678 views
0 votes
0 votes
1 answer
3
syncronizing asked Sep 21, 2018
5,363 views
Question:Find the number of tokens in the following C code using lexical analyzer of the compiler.
0 votes
0 votes
2 answers
4
saumya mishra asked Jun 12, 2018
2,266 views
In this question we will take n-=n1 as n=n-n1 as 5 tokens or n-=n1 as 4 tokens ????