for the following code can we consider '#define' as token?
#define int char
main(){
int i=65; // i is initialized
printf("sizeof(i)=%d",sizeof(i));
}
for the following code can we consider '#define' as token?
#define int char
main(){
int i=65; // i is initialized
printf("sizeof(i)=%d",sizeof(i));
}
The ISO C standard explicitly calls out what tokens exist, for example, in c11 6.4
:
token:
keyword
identifier
constant
string-literal
punctuator
preprocessing-token:
header-name
identifier
pp-number
character-constant
string-literal
punctuator
each non-white-space character that cannot be one of the above
So, no, #define
is not a token, it's two pre-processing tokens, #
and the define
identifier.
It's an identifier as per 6.4.2.1
where it's defined as basically [_A-Za-z][_A-Za-z0-9]*
.