sizeof calculates at compile time so their is no function call . in case of
function it gives the size of return type of that function

On Wed, Jul 27, 2011 at 9:41 PM, Abhinav Arora <[email protected]>wrote:

> ya Amit is right...
> sizeof(main()) will return 4 because main will return an
> integer.....however it will not execute main()..and sizeof(&main) will give
> 4 too but this time it is 4 because &main is a pointer to main
>
> another example
>
>
> #include<stdio.h>
> #include<conio.h>
> double foo();
> main()
> {
>       int a,b,c;
>       int **p;
>       printf("%d",sizeof(foo()));
>       getch();
>       }
> double foo()
> {
>        printf("Hi");
>        return 123.45;
>        }
>
>
> Here sizeof(foo())will return 8 which is the size of double. However it
> will not run the function foo.....and sizeof(&foo) gives 4 ...as it is a
> pointer to function foo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/IP5eG_wpP7oJ.
>
> 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.
>

-- 
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