I am reading about arrays in C++. I tried the following code:
int main()
{
int a[10];
int *p;
p = &a;
}
I got compiler error:
pointers.cpp:10:6: error: cannot convert ‘int (*)[10]’ to ‘int*’ in assignment
p = &a;
In order to understand the array type to be able to assign to a pointer I tried this code:
int main()
{
int a[10];
int *r[10];
r = a;
}
Compilation error:
: error: incompatible types in assignment of ‘int [10]’ to ‘int* [10]’
r = a;
Then I tried this:
int main()
{
int a[10];
int *r[10];
r = &a;
}
Compilation error:
error: incompatible types in assignment of ‘int (*)[10]’ to ‘int* [10]’
r = &a;
What is the type int (*)[10]
?