+ 2
int a = 1 ; printf ( "%d %d %d", a, ++a, a++ ) ;
what will be output of the following program a.) 1,2,3 b.)1,3,2 c.)1,3,3 d.)3,2,1
4 Answers
+ 4
A quiz question? The answer is 1, 2, 2, but such an option isn't there? Okay I don't really know
+ 3
It's 1 2 2
a is 1
So you print "a", after that ++a add 1 to the a, then a is 2.
And after that a++ used, this code first use a and after that add 1 to the a.
In fact printf(++a) is:
a = a + 1 //a is 2 now
printf(a)
And print(a++) means:
printf(a) //a printed at first
a = a + 1
+ 1
1, 2 , 2
- 1
write answer is 3,3,1
â can you explain it....