What is the type of p in the following C code?

int x = 10;
int *p1 = &x;
int **p = &p1;
                        

Options

  • A. Pointer to int
  • B. Pointer to pointer to int
  • C. Integer pointer array
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. Pointer to pointer to int

Detailed Explanation

Correct Answer: Option B

Explanation:
p1 is an int * because it stores the address of an integer. p is an int ** because it stores the address of the integer pointer p1. Thus, p is a pointer to a pointer to int.