Difference between int * a [3] and int (* a) [3]?

I want to know what is the difference between:

int *a[3]; 

AND

 int (*a)[3]; 

Thanks a lot, good luck.

+4
source share
2 answers

int *a[3] => a is an int * array

(a+1) will indicate the next integer in increments of integer size.

int (*a)[3] => pointer to an array of 3 integers

(a+1) will point to the next array of 3 integers in increments (3 * integer size)

Learn more about pointer to arrays

+6
source

int *a[3]; <- An array of 3 integer pointers

int (*a)[3]; <- Pointer to an array of 3 integers

+3
source

Source: https://habr.com/ru/post/1484394/


All Articles