Novice question about malloc and pointers
Russell T. Trotter
trotter at ENUXHA.EAS.ASU.EDU
Thu Apr 18 02:14:59 AEST 1991
I am trying to get an array of strings, therefore I am using the
following declaration: char *str[MAX] where MAX is an arbitrary
constant. My question is how do I allocate the memory for each
character position? Do all the characters strings for each element
in the array need to be allocated contiguously? The problem involves
reading in lines of input. Each line would be stored as a string and
the number of lines make up the number of elements in the array.
Any information would be greatly appreciated. Thank you.
trotter at enuxha.eas.asu.edu
More information about the Comp.lang.c
mailing list