>> if you write sizeof(main()) or sizeof(&main)...you will get 4 which will be
>> the size of a pointer

sizeof(main()) and sizeof(&main) are different.

sizeof(main()) is equivalent to sizeof( return type of main )
while sizeof(&main) is sizeof( function pointer )

On Jul 27, 9:02 pm, Abhinav Arora <[email protected]> wrote:
> The *sizeof* operator cannot be used with the following operands:
>
>    - Functions. (However, *sizeof* can be applied to pointers to functions.)
>    - Bit fields.
>    - Undefined classes.
>    - The type *void*.
>    - Dynamically allocated arrays.
>    - External arrays.
>    - Incomplete types.
>    - Parenthesized names of incomplete types
>
> so when you use main....its the name of a function and not pointer....in
> this case we get an implementational dependent unsigned integer which can be
> 1 too...
> if you write sizeof(main()) or sizeof(&main)...you will get 4 which will be
> the size of a pointer
>
>    -

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to