, .
.
, sizeof() ( ) , . .
:
#include <stdio.h>
void test(void (*f)(), int a[3]) {
printf("sizeof(f): %lu\n", sizeof(f));
printf("sizeof(a): %lu\n", sizeof(a));
printf(" f: %p\n", f);
printf("&f: %p\n", &f);
printf(" a: %p\n", a);
printf("&a: %p\n", &a);
}
void foo() {}
int main() {
int ints[3] = { 1, 2, 3 };
test(foo, ints);
}
, gcc:
address.c: In function βtestβ:
address.c:6:38: warning: βsizeofβ on array function parameter βaβ will return size of βint *β [-Wsizeof-array-argument]
printf("sizeof(a): %lu\n", sizeof(a));
^
address.c:4:28: note: declared here
void test(void (*f)(), int a[3]) {
^
, -, , , , , ( -) .
sizeof() , , , , va_start/va_arg .