I have tried a lot but I don't understand fully how postfix and prefix operator work in c language
How compiler execute line 8 and line 10
I have written code
X = 2
Y = 1
How compiler execute line 8 and line 10
I have written code
C:
#include<stdio.h>
int main()
{
int X = 1; // Compiler allocates memory for X and assign value 1
int Y; // Compiler only allocate memory for variable Y
Y = X++; // x become 2 , Y become 1
// Y = ++X; x become 2 , Y become 2
printf("X = %d \n", X);
printf("Y = %d", Y);
return 0;
}
Y = 1