Re: [algogeeks] Re: Do you Think Allocating memory to 2D Array is easy ???

2011-05-01 Thread Sathaiah Dontula
pptr = (char **) malloc (sizeof(char *) * ROW_MAX); ptr = (char *) malloc(sizeof(char) * row * col); for (index = 0; index < ROW_MAX; index++) { pptr[index] = ptr+index; ptr = ptr + ROW_MAX; } How about doing like above ?, you want only with one malloc ? Thanks, Sathaiah O

Re: [algogeeks] Re: Do you Think Allocating memory to 2D Array is easy ???

2011-05-01 Thread hary rathor
@harshit this not correct way . you will get segmentation fault while accessing the element .. you can see in book pointer in c -- 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. T

[algogeeks] Re: Do you Think Allocating memory to 2D Array is easy ???

2011-04-30 Thread bittu
although its right .& basic , funny way to allocate the memory , but i was looking fro sum better way to do the same .. Thanks 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@googleg