+ 2
Output of the following code:
#include<stdio.h> int main() { int i =5; printf("%d%d%d", i, i++, ++i) ; }
7 Réponses
+ 12
@Nawaj Shareef, then how do you explain:
char ch = 'A';
int ni = 89;
printf("Character = %c, Number = %d\n", ch, ni);
?????? It doesn't work right to left, the va_args of printf are left to right.
Edit: and anyways, the outcome like OP says, is 767 which still doesn't explain, even with your right to left theory, why the number would decline by one in the middle and return to 7 afterwards.
+ 8
I don't know the answer but plz give a like to my code so I can get a badge
+ 6
pretty sure its 557 unless some sorcery is going on there
+ 6
it should be giving you 557. Why? because the initial call to I is 5. the next call (i++) is post-increment to which means it will still be 5 until after it's use in this instance. The last call to i (++i) is a pre-increment call which means the now 6 valued i will become 7 before it's use giving you 557. I don't know what else you're doing to it but 557 is what you should be getting.
+ 5
The output of your code depends upon the compiler being used for compiler
- GCC is giving the output 767
- Turbo C++ is giving output 766
+ 3
well i never used c++. didnt know it compiled differently. at least in java the answer would be 557
+ 1
That's not the correct answer. It gives 767. I need to know how does this happen