#include <stdio.h>
#include <stdlib.h>
int main() {
    int x = 1, y = 1;
    printf("%d\n", ++x);
    printf("%d\n", x);
    return 0;
}
This code prints out 2, 2
But in this code:
#include <stdio.h>
#include <stdlib.h>
int main() {
    int x = 1, y = 1;
    printf("%d\n", x++);
    printf("%d\n", x);
    return 0;
}
it prints out 1, 2
why should it be 2, 1 since in the 1st printf statement we first assign value of x then it is increased means it should be 2 and in the 2nd printf statement the assigned value should be printed that is 1. 2 is not assigned, why is this happening?
 
    