@anika and sagar : Thanks Got it. On Sun, Aug 14, 2011 at 6:25 PM, sagar pareek <[email protected]> wrote:
> @rshetty > > for the first code > u have array as : -- _ _ _ _ _ _ _ _ _ _ ( _ denotes block of int) > so sizeof(*p) is ofcourse give you sze of int > > > now u have int *p[10][20]; > > which can be viewed as > > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > > > now *p is first 20 blocks (mean first whole row) > > which gives you sizeof(*p) as sizeof(int)*20 > which is *not equal* to sizeof(int)*20**10; > > > * > On Sun, Aug 14, 2011 at 6:12 PM, rShetty <[email protected]> wrote: > >> Please explain this ... >> >> #include<stdio.h> >> int main() >> { >> int *p[10]; >> printf("%d",sizeof(*p)); >> return 0; >> } >> >> Output is 4 >> >> For this program .... >> >> #include<stdio.h> >> int main() >> { >> int *p[10][20]; >> printf("%d",sizeof(*p)); >> return 0; >> } >> >> Output is 80 (10*20*sizeof(int)) >> >> -- >> 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. >> >> > > > -- > **Regards > SAGAR PAREEK > COMPUTER SCIENCE AND ENGINEERING > NIT ALLAHABAD > > -- > 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. > -- Regards Rajeev N B <http://www.opensourcemania.co.cc> "*Winners Don't do Different things , they do things Differently"* -- 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.
