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