Path: utzoo!news-server.csri.toronto.edu!rutgers!usc!sdd.hp.com!think.com!mintaka!bloom-picayune.mit.edu!news From: scs@adam.mit.edu (Steve Summit) Newsgroups: comp.lang.c Subject: Re: Is this ok?? Summary: yes, it was Keywords: pointer initialization Message-ID: <1991Mar9.073231.1364@athena.mit.edu> Date: 9 Mar 91 07:32:31 GMT References: <1991Mar08.191107.23161@pilikia.pegasus.com> Sender: news@athena.mit.edu (News system) Reply-To: scs@adam.mit.edu Distribution: comp Organization: Thermal Technologies, Cambridge, MA Lines: 35 In article <1991Mar08.191107.23161@pilikia.pegasus.com> art@pilikia.pegasus.com (Art Neilson) writes: >In article davis@pacific.mps.ohio-state.edu (John E. Davis) writes: ... >>void fm2(s) >>char **s; > ^ here we go yet again, this parameter doesn't match > what you're trying to pass in from fm1(). >>{ >> *s = "Hello\n"; > ^ you can't do this. s points nowhere. > besides, you need to do strcpy(s, "Hello"), > the way you are initializing *s is wrong. ... >> char *s; >> fm1(&s); > ^why are you passing "address of" s ? > s is already an address, remove the &. > >You should really read your textbook before posting something like this >to the net. Any book worth it's salt will teach you not to make the >sort of mistakes you've made here. Yes, it is important to make sure you understand what's going on before you post. The code posted by John Davis was correct, although it contained several (perfectly legal) pointers to pointers which apparently confused both a VMS compiler (thus John's original question) and Arthur Neilson (thus these irrelevant criticisms). The code passes lint -hbxa with flying colors (i.e. no complaints about argument mismatches) and runs correctly under any number of compilers. Steve Summit scs@adam.mit.edu