0

#include <stdio.h> int main() { int x=4,y,z; y=--x; z=x--; printf("%d",x); return 0; } output value and why ??

#include <stdio.h> int main() { int x=4,y,z; y=--x; z=x--; printf("%d",x); return 0; }

17th Aug 2021, 4:42 PM
PARTHA SARATHI DAS
PARTHA SARATHI DAS - avatar
2 Answers
+ 4
ahh, how bigger your balls are by posting the whole code in the title, now the forum looks ridiculous the output would be 2 since you're decrementing x, y and z doesn't have any initial value stored
17th Aug 2021, 4:45 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
y = --x; // now x = 3 z = x--; // next time x = 2 So printf gives 2
18th Aug 2021, 5:04 AM
Mohd Aadil
Mohd Aadil - avatar