#include <stdio.h>

int main() {
    //legal (1)
    int a = 1;
    int **ptr2;
    int *ptr1;
    
    ptr2 = &ptr1;
    ptr1 = &a;

    printf("%d\n", **ptr2);

    //legal (2) : 
    int **n_ptr2;
    int *n_ptr1;
    int b = 2;

    n_ptr2 = &n_ptr1;
    n_ptr1 = &b;
    printf("%d", **n_ptr2);

    /**
    //illegal: assignment to 'int **' from 'int *'
    int b = 2;
    ptr2 = &b; //Q. why &b regarded as int *?
    printf("%d", **ptr2);
    **/
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: