Could someone please explain me what I'm doing wrong?
Actually I want getPointer()
to return an array (with size of 3 pointers) of pointers to integers. That's my main plan. An alternative for me was to return a pointer to that array of pointers.
int value = 5;
int *(*array1)[3];
int* (*getPointer())[3] {
int *pValue= &value;
array1[0] = pValue; // throws the error
return array1;
}
int main() {
return 0;
}
That's the error message:
error: incompatible types in assignment of 'int*' to 'int* [3]'