sizeof
is evaluated at compile time, not at runtime. The compiler does not analyse what you pass to function size
, but rather treats the function parameter as a pointer. Thus in your function size
the result of sizeof a
is the size of a pointer to an int
, which is, by chance, equal to the size of an int
on your system.