I have just started to learn the 'C' language. I was practicing some problems and faced this doubt.
#include <stdio.h>
int main()
{
int x=4, y, z;
y=--x;
z=x--;
printf("%d %d %d\n", x, y, z);
return 0;
}
I have just started to learn the 'C' language. I was practicing some problems and faced this doubt.
#include <stdio.h>
int main()
{
int x=4, y, z;
y=--x;
z=x--;
printf("%d %d %d\n", x, y, z);
return 0;
}
Here, x is decremented once: y=--x;.
Here, it is decremented the second time: z=x--;.
It starts off as 4, from init here int x=4.
The result is 2.