search
Log In
1 vote
259 views

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
edited by
259 views

2 Answers

1 vote
 
Best answer

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


selected by
0

@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.

2
$*$ 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.
0 votes
58 is correct ans

Related questions

0 votes
1 answer
1
0 votes
0 answers
3
0 votes
1 answer
4
77 views
COMMENT(how the below statement is true) LL(k) languages are proper subset of LL(k-1) languages.
asked Nov 18, 2018 in Compiler Design Jyoti Kumari97 77 views
...