The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+1 vote
80 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 by (23 points)
edited by | 80 views

1 Answer

+1 vote
Best answer

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

by Veteran (51k points)
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.

Related questions

0 votes
0 answers
2
0 votes
0 answers
7
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,309 questions
55,743 answers
192,222 comments
90,491 users