Why doesn't this work?
Scott Bigham
sbigham at dukeac.UUCP
Thu Mar 23 16:09:24 AEST 1989
My annual C question:
Is there a particularly glaring reason that the following code should make the
compiler unhappy?
------------------- Quick, Robin! The BAT-scissors! -------------------
typedef char **Block;
Block
b1 ={"this","that"},
b2={"yes","no"},
B[]={b1,b2};
-------------------------------------------------------------------------
It curses at me thusly:
"test.c", line 6: warning: illegal pointer combination, op =
"test.c", line 6: initialization alignment error
"test.c", line 6: warning: illegal pointer combination, op =
Fatal error in /lib/comp
Status 0210
I thought of changing the first line to "typedef char **Block", but that gave
me worse:
"test.c", line 4: warning: illegal pointer combination, op =
"test.c", line 4: initialization alignment error
"test.c", line 4: warning: illegal pointer combination, op =
"test.c", line 4: initialization alignment error
"test.c", line 5: warning: illegal pointer combination, op =
"test.c", line 5: initialization alignment error
"test.c", line 5: warning: illegal pointer combination, op =
"test.c", line 5: initialization alignment error
"test.c", line 6: illegal initialization
"test.c", line 6: illegal initialization
I'm sure it's quite obvious to everyone but me what's wrong with this. I
guess that's what I get for trying to understand C after midnight. Thank
you very much for unbefuddling me.
sbigham
--
Scott Bigham "The opinions expressed above are
Internet sbigham at dukeac.ac.duke.edu (c) 1989 Hacker Ltd. and cannot be
USENET sbigham at dukeac.UUCP copied or distributed without a
...!mcnc!ecsgate!dukeac!sbigham Darn Good Reason."
More information about the Comp.lang.c
mailing list