Path: utzoo!mnetor!uunet!yale!husc6!cca!g-rh From: g-rh@cca.CCA.COM (Richard Harter) Newsgroups: comp.lang.c Subject: Re: C pointer problems in VMS. Message-ID: <25667@cca.CCA.COM> Date: 18 Mar 88 03:55:19 GMT References: <12464@brl-adm.ARPA> Reply-To: g-rh@CCA.CCA.COM.UUCP (Richard Harter) Organization: Computer Corp. of America, Cambridge, MA Lines: 38 In article <12464@brl-adm.ARPA> V053MF43@ubvmsc.cc.buffalo.EDU (Mike Ayers) writes: o ... with sundry problems >char *wr(a) >int a; >{ body } >main() >{ <------- char *wr() goes here, your code declares wr as a function returning an int (the default if there is no declaration.) > printf(" %s ",wr(4)); >} >main() >{ > char b[12]; > b[0]='A'; > strcpy(((&b)+1),"rf!"); The expression &b should be &b[0]. b is an array and is a pointer (sort of :-)). You are passing a pointer to a pointer. b[0] is the first element of b. &b[0] points to it. I say 'sort of' because there are subtle differences between arrays and pointers in C. Some people can explain the difference; others can explain trans- substantiation. I shall attempt neither in a public forum. > printf(" %s ",b); >} -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.