Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!mephisto!mcnc!rti!xyzzy!farm!taylor From: taylor@farm.rtp.dg.com (William Taylor) Newsgroups: comp.unix.wizards Subject: Re: Ack! No fun pointer problem. Message-ID: <1100@xyzzy.UUCP> Date: 9 Mar 90 21:58:41 GMT References: <14461@s.ms.uky.edu> Sender: usenet@xyzzy.UUCP Reply-To: taylor@dg-rtp.dg.com Followup-To: <14461@s.ms.uky.edu> Organization: Data General Corp., Research Triangle Park, NC Lines: 23 In article <14461@s.ms.uky.edu>, sean@ms.uky.edu (Sean Casey) writes: > Given the following definitions, can you show me how to print "fun" > using only "a"? You can't change the two definitions. > > main() > { > char *s = "fun"; > char *a = (char *) &s; > > print fun here > } #include main() { char *s = "fun"; char *a = (char *) &s; printf("%s\n", *((char **)a)); } William Taylor taylor@dg-rtp.dg.com Data General Corporation {world}!mcnc!rti!dg-rtp!taylor 62 T. W. Alexander Drive Research Triangle Park, NC 27709 (919) 248-5801