one more question. how to dynamically allocate memory for int *a[3]; ? On Wed, Jul 27, 2011 at 5:57 PM, Kamakshii Aggarwal <kamakshi...@gmail.com>wrote:
> thanks ankit and ramya..:) > > > On Wed, Jul 27, 2011 at 5:42 PM, Ankit <ankitchaudhar...@gmail.com> wrote: > >> p is a pointer to an array of 4 ints. >> sizeof(p) gives the size of the pointer which is an int and sizeof(*p) >> gives the size of the array it points (4*4=16) >> >> On Jul 27, 3:44 pm, Kamakshii Aggarwal <kamakshi...@gmail.com> wrote: >> > #include<stdio.h> >> > # define MAXROW 3 >> > #define MAXCOL 4 >> > >> > int main() >> > { >> > int (*p)[MAXCOL]; >> > p=(int(*)[MAXCOL])malloc(MAXROW*sizeof(*p)); >> > printf("%d %d",sizeof(p),sizeof(*p)); >> > >> > system("pause"); >> > >> > return 0; >> > >> > } >> > >> > THE O/P IS 4 16. >> > I am not getting the reason.plss help >> >> -- >> 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. >> >> > > > -- > Regards, > Kamakshi > kamakshi...@gmail.com > -- Regards, Kamakshi kamakshi...@gmail.com -- 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.