+ 1
What is the difference between following declarations??(in C)
int* arr1[8]; int (*arr2)[8]; int *(arr3[8]);
2 Antworten
+ 1
int* arr1[8] and int *(arr3[8]) are same and it means that it will create a pointer array of size 8, i.e. instead of normal array of integers it will be array of pointers and it can store 8 addresses of integer variables.
as for the second syntax int (*arr2)[8] defines a pointer to an array:
int b[8];
int (*arr2)[8] = &b;
now arr2 will have the same values as that of b.
0
First and third are same result and defined pointer to an array.
But in second declaration you defined an array of pointers