if its size of return type, the program has to show segmentation error (it calls main infinitely,BTW size of void = 1).
Thank you, Sid. On Tue, Sep 6, 2011 at 11:26 PM, Sanjay Rajpal <srn...@gmail.com> wrote: > if main() were a pointer, then > char c() > { > return '1'; > } > > int main() > { > printf("%d",sizeof(c())); > } > would also have shown 4, but it shows 1. I think there is a hidden concept. > > If we change the return type of c() to void, it shows an error. > But instead of c(), we use main() with void as return type, it shows 4. > > Whats happening here ? > > > > > Sanju > :) > > > > On Tue, Sep 6, 2011 at 10:51 AM, siddharam suresh <siddharam....@gmail.com > > wrote: > >> *main()* is an address/probably the function pointer, >> Thank you, >> Sid. >> >> >> >> On Tue, Sep 6, 2011 at 11:19 PM, Sanjay Rajpal <srn...@gmail.com> wrote: >> >>> #include <stdio.h> >>> #include<conio.h> >>> int main() { >>> >>> printf(" %d",sizeof(main())); >>> ... getche(); >>> return 0; >>> } >>> o/p is 4..how ??? >>> >>> >>> Sanju >>> :) >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> 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 algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> 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 algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.