Ack! No fun pointer problem.

William Taylor taylor at farm.rtp.dg.com
Sat Mar 10 07:58:41 AEST 1990


In article <14461 at s.ms.uky.edu>, sean at 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 at 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



More information about the Comp.unix.wizards mailing list