[Solved] j = *x; x = &j; (*x) = 3; why that will change the value of j in c [closed]


int main()
{
    int i,j;   // declaration of i and j
    int *x;    // x points to an integer
    i = 1;     // initialization of i = 1
    x = &i;    // initialization of x = address of i
    j = *x;    // initialization of j = value of what pointed by x => j = 1

    printf("i = %d, j = %d\n", i, j); //i = 1, j = 1

    x = &j;    // assign to x the address of j
    (*x) = 3;  // assign 3 to what pointed by x 
               // x points to j, so j = 3

    printf("i = %d, j = %d", i, j); // i = 1, j = 3
}

solved j = *x; x = &j; (*x) = 3; why that will change the value of j in c [closed]