Declaration Question

William Setzer IDM setzer at nssdcs
Tue Jul 25 08:49:01 AEST 1989


Will this declaration:

char *foo[K][N];

allocate the following picture?  (i.e.  Will it initialize
the pointers properly and allocate memory for all the blocks shown?)
If not, is there a (single) declaration that will?

  foo
   |
   v
+-------+      +---...---+
| ptr1 ------> | N chars |
+-------+      +---...---+
| ptr2 ------> | N chars |
+-------+      +---...---+
|   :   |      |    :    |
|   :   |      |    :    |
+-------+      +---...---+
| ptrK ------> | N chars |
+-------+      +---...---+

(Unfortunately, a dbx on my machine proved inconclusive.)
Thanx in advance.
--
William Setzer
setzer at epsl.umd.edu   ; My 'real' mail address.



More information about the Comp.lang.c mailing list