what is the output can anyone explain! int a=10, b; b= --a + --a; printf ("%d", a); printf ("%d", b);
It will print 8 & 17
What you are seeing here is undefined behaviour ( or more appropriately an implementation defined behaviour ) because your program is changing value of "a" multiple times between 2 sequence points. Such constructs are are forbidden in C/C++ as output of such programs can't be predicted and would vary depending on the language implementation you are using.( in most of the cases, your compiler should also warn you about the same )
Thank u for ur response ..but i got some different answer as 8 and 16.... Please check it out Yahel Saurabh Kumar Yadav
Saran_37, You are right... if anyone knows why- I'd also like to know :)
8 and 17. Pre-decrement decrements the value by 1 and only then does the wanted operation with it.
When I run in compiler it shows... 8 and 16 ...can anyone explain
Answer is 8 and 16
I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.
Python palindrome challenge.