these are asked for which profyl??developer or white box?? On Sat, Jun 30, 2012 at 8:03 PM, Amol Sharma <[email protected]> wrote:
> @sarthak : > in your first solution aren't you using nrows+1 malloc's ? > > second solution is good using 1 malloc. > -- > > > Amol Sharma > Final Year Student > Computer Science and Engineering > MNNIT Allahabad > > <http://gplus.to/amolsharma99> > <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://www.simplyamol.blogspot.com/><http://facebook.com/amolsharma99> > > > > > > > On Fri, Jun 29, 2012 at 5:35 PM, sarthak rai <[email protected]>wrote: > >> 2 malloc(): >> int **a=(int **)malloc(sizeof(int *)*nrows); >> for(i=0;i<nrows;i++) >> a[i]=(int *)malloc(sizeof(int)*ncols); >> >> using only 1 malloc: >> int **a=(int **)malloc(sizeof(int *)*nrows+(nrows*ncols)*(sizeof(int))); >> for(i=0;i<nrows;i++) >> { >> a[i]=(int*)(a+nrows+i*ncols); >> >> } >> >> On Fri, Jun 29, 2012 at 4:46 PM, rahul r. srivastava < >> [email protected]> wrote: >> >>> implement a 2d matrix using only 2 mallocs. >>> >>> -- >>> 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/-/s4vvxtO2yVsJ. >>> 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. >> > > -- > 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. > -- 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.
