4 ms·
No. Array names are immutable. Pointer values may be mutable. However, let's ignore that and consider "int a[10]; int * const p(a);" sizeof(a) is the size o
by anamax 17y ago
No.
Array names are immutable. Pointer values may be mutable.
However, let's ignore that and consider "int a[10]; int * const p(a);"
sizeof(a) is the size of the array named a or 4 * sizeof(int). sizeof(p) is the size of the pointer named p.
- matthavener 17y agosizeof(array) works in a block, but as a function parameter, it'll return sizeof(void*). i.e. void f(int a[4]) { printf("%d", sizeof(a)); } int main() { int b[4]; f(b); } ... yields "4" (on my 32-bit machine)