[ILUG-BOM] Re: Buggy C prog

Philip S Tellis philip@[EMAIL-PROTECTED]
Fri Sep 27 10:39:54 IST 2002

On Fri, 27 Sep 2002, Amish Mehta wrote:

> You got divine hands :-). Though it worked, you should still allocate
> memory to arg itself for holding array of pointers. Something like

No he shouldn't.  When he does char *arg[4];  That's when memory is 
allocated for four pointers.  If instead he had done char **arg, then he 
would have to allocate memory himself.  Now, he only has to allocate 
memory for each of the four pointers in the array, using the code that 
he already has.

Nikhil, I hope this answers your question too about how to allocate 
memory for an array of pointers.

You can't grep dead trees

More information about the Linuxers mailing list