Path: utzoo!attcan!uunet!lll-winken!xanth!mcnc!ecsvax!dukeac!sbigham From: sbigham@dukeac.UUCP (Scott Bigham) Newsgroups: comp.lang.c Subject: Why doesn't this work? Message-ID: <1309@dukeac.UUCP> Date: 23 Mar 89 06:09:24 GMT Reply-To: sbigham@dukeac.UUCP (Scott Bigham) Organization: Academic Computing, Duke University, Durham, NC Lines: 47 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@dukeac.ac.duke.edu (c) 1989 Hacker Ltd. and cannot be USENET sbigham@dukeac.UUCP copied or distributed without a ...!mcnc!ecsgate!dukeac!sbigham Darn Good Reason."