Answer the question
In order to leave comments, you need to log in
Why is sizeof ( somefunc ) == 1?
Dear C Experts, attention to the question:
I always thought that I know C pretty well. But recently I came across this feature:
int main(){
printf ( "%x %x\n" , sizeof ( &main ) , &main ) ;
printf ( "%x %x\n" , sizeof ( main ) , main ) ;
return 0 ;
}
8 87a05a0
1 87a05a0
Answer the question
In order to leave comments, you need to log in
https://msdn.microsoft.com/en-us/library/4s7x1k91.aspx
The sizeof operator never produces a result of 0, even for an empty class.
The sizeof operator cannot be used with the following operands:
Functions. (However, the sizeof operator can be applied to function pointers.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question