#: 3441 S10/Tandy CoCo
13-May-90 01:07:26
Sb: #c-array initialization
Fm: Bob van der Poel 76510,2203
To: all
Okay, time for my next "innocent 'C' question".
I would like to initialize an array of pointers so that each pointer points to
an array of values. For example, I can get the correct results by doing;
char data[][3]={
{1,2,3},
{.....}
But this seems to be wasteful if the data are all constants. There is no need
for it to be transfered from the program area to the data area. I thought I
could do something like
char *data[][4]={}
But of course, this sets up a double array of pointers. Not what I want. I
simply want a pointer to data[0][0], a second pointer to data[1][0], etc. Heck,
I'd even settle for a single dimensioned array with a pointer pointing to the
start of the whole mess. What I can't figure is how to define the data. It can
be done with strings...but what about values?
There is 1 Reply.
|