#include <stdio.h>
int main() {
int *a[2]; // an array of 2 int pointers
int (*b)[2];
// pointer to an array of 2 int (invalid until assigned) //
int c[2] = {1, 2}; // like b, but statically allocated
printf("size of int %ld\n", sizeof(int));
printf("size of array of 2 (int *) a=%ld\n", sizeof(a));
printf("size of ptr to an array of 2 (int) b=%ld\n", sizeof(b));
printf("size of array of 2 (int) c=%ld\n", sizeof(c));
return 0;
}
a
は 2 つの整数ポインターの配列なので、サイズは2 * 4 = 8
?
GCC でテスト済み。