taylor@farm.rtp.dg.com (William Taylor) (03/10/90)
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 <stdio.h> 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