I have experimented with the code?
C Interview Questions and Answers
(Continued from previous question...)
I have experimented with the code?
Q: I've experimented with the code
int i = 3;
i = i++;
on several compilers. Some gave i the value 3, and some gave 4. Which compiler is correct?
A: There is no correct answer; the expression is undefined. (Also, note that neither i++ nor ++i is the same as i+1. If you want to increment i, use i=i+1, i+=1, i++, or ++i, not some combination.
(Continued on next question...)
Other Interview Questions
|