Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!husc6!psuvax1!vu-vlsi!swatsun!pomeranz From: pomeranz@cs.swarthmore.edu (Hal Pomeranz) Newsgroups: comp.lang.c Subject: Double inderection question Keywords: is this messed up or am I? Message-ID: <2001@tulum.cs.swarthmore.edu> Date: 2 Aug 88 17:23:37 GMT Organization: Sun Lab, Swarthmore College PA Lines: 43 Consider the following: char array[10], **ptr; main() { ptr = &array; . . . } Now, when I try and compile this program with our C compiler (Sun OS 4.0), I get something like 'warning: & before array or function: ignored'. I've also tried '&&array[0]', '&&(array[0])', '&(&array[0])', etc. and none of these has worked. From my limited understanding 'array' is a pointer to the first element (i.e. a pointer to array[0]), so &array should be a pointer to the pointer. It is possible that I'm inferring too much from K&R, but this seems like a reasonable extension of the rules they lay down. So my question is: where does the fault lie? With my understanding? With the C compiler? Or (*gasp*) with K&R for not making consistant rules? As a side point, the following does work: char array[10], **ptr, *bogus_ptr; main() { bogus_ptr = array; ptr = &bogus_ptr; . . . } It strikes me that if I can do what I want in this roundabout way, I should also be able to do it directly. Hal Pomeranz -- ______________________________________________________________________________ |UUCP: ...!rutgers!bpa!swatsun!pomeranz | Living on a lighted stage |CS Net: pomeranz@cs.swarthmore.edu | approaches the unreal... |BitNet: vu-vlsi!swatsun!pomeranz@psuvax1.bitnet | -Rush