Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site dataio.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!houxm!vax135!cornell!uw-beaver!uw-june!entropy!dataio!buls From: buls@dataio.UUCP (Rick Buls) Newsgroups: net.lang.c Subject: Quiz for Novice to Intermediate C Users Message-ID: <646@dataio.UUCP> Date: Wed, 17-Apr-85 17:35:51 EST Article-I.D.: dataio.646 Posted: Wed Apr 17 17:35:51 1985 Date-Received: Thu, 18-Apr-85 05:20:36 EST Distribution: na Organization: Data I/O Corp., Redmond WA Lines: 29 /* ** Ok netland its C quiz time. Not to be found in ** "The C Puzzle Book" by Alan Feuer. ** ** Below is a C program that tests the famous foo. ** ** The question: what does the following program print? ** ** Spoiler: The answer is NOT "foo returns 5" ** */ #define dum(x) /* empty debug macro */ main() { printf("foo returns %d\n",foo()); /* print answer */ } foo() { int a,b,*p= &a; /* p points to a */ b=10; *p=2; /* set a to 2 */ a=b/*p; /* div b by contents of pointer(ie a) */ dum(a); return(a); }