What is the difference between int *a[3]
and int (*a)[3]
?
If you have any doubt, using this g++ trick is often handy:
#include
template < class T > void describe(T& )
{
// With msvc, use __FUNCSIG__ instead
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
int main(int argc, char* argv[])
{
int *a[3];
describe(a);
int (*b)[3];
describe(b);
return EXIT_SUCCESS;
}
Compile it with g++ and run it, you'll get:
void describe(T&) [with T = int*[3]]
void describe(T&) [with T = int (*)[3]]
So, they are definitely NOT the same ! What you have is: