+ 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

5th Nov 2018, 5:48 AM
Shubham rathore
Shubham rathore - avatar
4 odpowiedzi
+ 4
A quiz question? The answer is 1, 2, 2, but such an option isn't there? Okay I don't really know
5th Nov 2018, 6:04 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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
5th Nov 2018, 8:31 AM
Mehran sanea
Mehran sanea - avatar
+ 1
1, 2 , 2
7th Nov 2018, 2:03 PM
Piotr
Piotr - avatar
- 1
write answer is 3,3,1 ❓ can you explain it....
5th Nov 2018, 6:49 AM
Shubham rathore
Shubham rathore - avatar