Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!columbia!cheshire.columbia.edu!francus From: francus@cheshire.columbia.edu (Yoseff Francus) Newsgroups: comp.lang.c Subject: Re: char (*a)[] (was: Style [++i vs i++]) Message-ID: <4928@columbia.edu> Date: Mon, 24-Aug-87 09:03:25 EDT Article-I.D.: columbia.4928 Posted: Mon Aug 24 09:03:25 1987 Date-Received: Tue, 25-Aug-87 04:28:58 EDT References: <8942@brl-adm.ARPA> Sender: nobody@columbia.edu Reply-To: francus@cheshire.columbia.edu.UUCP (Yoseff Francus) Organization: Columbia University CS Department Lines: 41 In article <8942@brl-adm.ARPA> DHowell.ElSegundo@Xerox.COM writes: >I'm confused. > >Suppose I declare: > >char (*a)[10]; >char b[10]; > >Now b is an array of size 10 of char, and a is a pointer to an array of >size 10 of char. So this means I should be able to say: > >a = &b; > >However, as I understand it, b is actually &b[0], which means a gets set >to &&b[0], which I'm not sure makes any sense at all. > >What exactly does a point to? Does it point to the first element of an >array? Does it point to a descriptor of an array? How would I assign >anything useful to a, if I can't use the above type of assignment? Or >is the assignment valid? If so what is the meaning of &b? > >Dan Since b is the name of an array it is considered to be a constant, and you cannot use the & operator on a constant. The assignement you want is simply a = b; Be careful though, since a++ will not move to the next character, but rather will jump forward by 10*sizeof(char). ****************************************************************** yf In Xanadu did Kubla Khan a stately pleasure dome decree But only if the NFL to a franchise would agree. ARPA: francus@cs.columbia.edu UUCP: seismo!columbia!francus