#include<stdio.h>
int main()
{
int i=2;
int j=++i + ++i + i++;
printf("%d\n",i);
printf("%d\n",j);
}
Answer Posted / vadim g
i=5 and j=12
Here is the sequence of operations:
1. i = 2 => result i = 2
2. first ++i => result: i = 3
3. second ++i => result: i = 4
4. j assignment => result: j = 4 + 4 + 4 = 12
5. i post increment => i = 5
MSVC++ gives 5 and 12.
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
Explain the advantages of using macro in c language?
What does %p mean c?
What are different types of variables in c?
When should the volatile modifier be used?
How can I use a preprocessorif expression to ?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
What is the difference between strcpy() and memcpy() function in c programming?
What are the salient features of c languages?
How can I avoid the abort, retry, fail messages?
What is 2c dna?
What is the difference between far and near in c?
What is far pointer in c?
There seem to be a few missing operators ..
Why is %d used in c?