Search code examples
tokencompiler-construction

Number of tokens in the statement


Number of tokens in the statement:

printf(“i=%d,&i=%x”,i,&bi);

can any one say ?


Solution

  • 1 printf=Function (identifier),
    2 (=ParenthesisOpen,
    3 i=%d,&i=%x=String (template get parsed by printf),
    4 ,=Comma
    5 i=Variable (identifier),
    6 ,=Comma
    7 &=Ampersand (reference),
    8 bi=Variable (identifier),
    9 )=ParenthesisClose,
    10 ;=EndOfStatement