The declarations
int arr[10];
int *arr1[10];
are straightforward. The first declares an array of 10 integers while the second declares a 10 value array of pointers to int (int *).
Now, consider these declarations:
int (*arr2)[10];
int *(*arr3)[10];
What do these even mean? Considering the parenthesis, they are trying to dereference arr2 and arr3 in the declaration? Is this even possible?
Can anyone answer what is the type of values stored in these arrays and if I do something like *arr2 or *arr3, what would the value be?
Also, what is the type of arr2 and arr3 now?
In these declarations:
int arr[10];
int *arr1[10];
int (*arr2)[10];
int *(*arr3)[10];
arr is an array[10] of ints.
arr1 is an array[10] of pointers to int.
arr2 is a pointer to an array[10] of ints.
arr3 is a pointer to an array[10] of pointers to int.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With