Jan Engelhardt <> writes:
>>i'm surprised at the output of the following code. compiled in turbo C
>>
>>void main()
>>{
>>printf("%d",sizeof(printf());
>>}
>>the output was : 2
>
> Given that <stdio.h> was included, the return type of printf is int,
> and an int in turbo C is a 16-bit entity.
Given that <stdio.h> *wasn't* included, the compiler assumes that any
unrecognized function returns an int. See my other response on this
thread.
>>how come the output is 2? actually what is the property of sizeof()
>
> Try again on a modern compiler and you should get 4.
It depends on the system.
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.