Home > Back-end >  Reading the pointer declaration as an English statement
Reading the pointer declaration as an English statement

Time:01-02

Consider the following pointer declarations.

int *p[10];

int (*q)[10];

What is the difference between 1st and second. How to read them in plain English?

Example:

int *p; // it will be read as "p is a pointer to an int"

int **p;  // p is a pointer to an integer pointer.

CodePudding user response:

int *p[10] is an array of 10 pointers to int. int (*q)[10] is 1 pointer to an array of 10 ints.

  • Related