edited by
1,282 views
5 votes
5 votes

How many tokens are there in each

  1. ->
  2. int *ptr = &x;
  3. ++a
  4. >=
  5. !=
  6. x += 10;

Token should be counted before pre-processing or after it?

from my experience only, I'm able to identify what are considered as tokens are and what not. I want a reliable reference to know what all tokens are there in C. Does a token depends on what compiler is in use? 

Create a standard list of tokens for GATE exam.

edited by

2 Answers

4 votes
4 votes
  1. ->  token = 1 
  2. int *ptr = &x; token = 7
  3. ++a token = 2
  4. >=  token = 1
  5. !=  token = 1
  6. x += 10; token= 4

Find maximum length lexeme.which has some meaning 

example ++ we can think it is two + but ++ has meaning of increament. so considerd as 1

edited by

Related questions

6 votes
6 votes
1 answer
1
Manu Thakur asked Sep 29, 2017
4,593 views
Given answer is 25, while my answer is 26, they have considered -10.0 as single token, which is wrong?
3 votes
3 votes
1 answer
2
Himanshu Goyal asked Aug 27, 2016
628 views
Is call by address in C same to call by reference in C++? if not then whats basic difference ?? and why doesn't C have a refernce variable just like C++??
3 votes
3 votes
4 answers
3
Deepak Singh 7 asked Mar 15, 2018
1,259 views
Number of tokens in $\text{int a[5];}$