retagged by
2,547 views
4 votes
4 votes

retagged by

2 Answers

Best answer
7 votes
7 votes
main()
{
    int x, y;
    fl/*gate oat z;
    x =/*exam*/10;
    y = 20;
}

Total number of tokens = 17.

These are the tokens:

  1. main
  2. (
  3. )
  4. {
  5. int
  6. x
  7. ,
  8. y
  9. ;
  10. fl
  11. 10
  12. ;
  13. y
  14. =
  15. 20
  16. ;
  17. }

The comment starts with a /* and ends to the nearest */. Therefore

/*gate oat z;
x =/*exam*/

will be considered a single token.

And "fl" and "10" will be separated as two different tokens.

selected by
4 votes
4 votes

main

(

)

{

int

x

,

y

;

fl

10

;

y

=

20

;

}

Therefore, total of 17 tokens.

Related questions

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