If I have int x[10]
and int *y
, how can I tell the difference between the two?
I have two ideas:
sizeof() is different.
&x has different type ---
int (*p)[10] = &x
works but notint **q = &x
.
Any others?
In some template library code, I need to determine whether a pointer is a "real" pointer or degenerated from an array. I can't look at source code as the library user does not exist until I write the library. ... I can work around this by rewriting the code, so now this is only a theoretical exercise.