in Compiler Design retagged by
1,531 views
1 vote
1 vote

Find the number of tokens in the following C code$:$

main()
{
   int x = 10 , *P ;
   int y = x ++ ;
   char * q ; 
   P = & x ; q = 'A' ;
   if(*P>=10)
   {
     *P = x + 100;  
   }
   else
  {
    printf("%d" , x);
     /*comment*/ 
  }

}
in Compiler Design retagged by
1.5k views

2 Answers

2 votes
2 votes
Best answer

There $>=$   $(or)$   $\geq$ are only one token(because this is a operator in C language).

selected by

2 Comments

@Lakshman Patel RJIT Is *P count to one token or two? My doubt is because it is a pointer variable..can you please tell about same for 'A' it is counted one not three.

0
0
$*$ is the operator and $P$ are identifier so we count $*$P as two tokens.And for $'A'$, this is the character literal so we count as one token.
3
3
0 votes
0 votes
58 is correct ans
Answer:

Related questions