I wonder about tokens and how they are evaluated by the compiler. But I never considered space as an important token for parsing a statement,
For instance.
#include<stdio.h>
int main(){
int first=1,second=3;
int res=first+++++second;
printf("%d \n",res);
return 0;
}
Gives the following error:
rough3.c: 7: 17: error: lvalue, required as an increment operand int res = first +++++ second;
But just adding "" between the two postfix (++) and the prefix (++) seems to work fine.
#include<stdio.h>
int main(){
int first=1,second=3;
int res=first++ + ++second;
printf("%d \n",res);
return 0;
}
Performs small fonts with a value of 5. I examined this question , and then the undefined behavior I want to know:
When does the compiler decide that spaces between expressions are redundant or not?
What happens when we put priority and associativity together to evaluate these expressions?