I have not written code in C for a while, so pardon any gaffes. Let us say the dimensions of the array to be created are m and n. To create the array - (int *)malloc(sizeof(int)*m*n); To access - arr[i][j] => get the memory location by n*i+j.
--Anurag On Fri, Apr 29, 2011 at 6:00 PM, bittu <shashank7andr...@gmail.com> wrote: > Basically we have to implement function which allocates memory to a > two dimensional array. we have to Minimize the number of calls to > malloc and make sure that the memory is accessible by the notation > arr[i][j]. > > .important part of the question is we have to implement the it using > single call to MALLOC..its strictly means only 1 time ?? so make sure > your not calling malloc more then 1 so lets make our hand dirty..?? > > Please Read Question Carefully... > > > > > > Thanks & Regrads > Shashank > > -- > 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.