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



On Sun, May 1, 2011 at 11:47 PM, hary rathor <[email protected]> wrote:

> @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 [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.

Reply via email to