#include <stdio.h>
#include <stdlib.h>
#define ARRAYSIZE(arr) ((sizeof(arr) != sizeof(&arr[0])) ? \
(sizeof(arr)/sizeof(*arr)) : \
-1+0*fprintf(stderr, "\n\n** pointer in ARRAYSIZE !! **\n\n"))
int main(void) {
int test[12];
int* test2
= malloc(12*sizeof(int));
printf("size = %d\n", ARRAYSIZE
(test
)); printf("size = %d\n", ARRAYSIZE
(test2
));
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KIAojZGVmaW5lIEFSUkFZU0laRShhcnIpICgoc2l6ZW9mKGFycikgIT0gc2l6ZW9mKCZhcnJbMF0pKSA/IFwKICAgICAgICAgICAgICAgICAgICAgICAoc2l6ZW9mKGFycikvc2l6ZW9mKCphcnIpKSA6IFwKICAgICAgICAgICAgICAgICAgICAgICAtMSswKmZwcmludGYoc3RkZXJyLCAiXG5cbioqIHBvaW50ZXIgaW4gQVJSQVlTSVpFICEhICoqXG5cbiIpKQoKaW50IG1haW4odm9pZCkgewoJCglpbnQgdGVzdFsxMl07CglpbnQqIHRlc3QyID0gbWFsbG9jKDEyKnNpemVvZihpbnQpKTsKCQoJcHJpbnRmKCJzaXplID0gJWRcbiIsIEFSUkFZU0laRSh0ZXN0KSk7CglwcmludGYoInNpemUgPSAlZFxuIiwgQVJSQVlTSVpFKHRlc3QyKSk7CgkKCWZyZWUodGVzdDIpOwoJCglyZXR1cm4gMDsKfQo=