Quiz for Novice to Intermediate C Users

Goldilocks lspirkov at udenva.UUCP
Mon Apr 22 11:09:02 AEST 1985


In article <> buls at dataio.UUCP (Rick Buls) writes:
>
>#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);
>}

on the line where you have:
	a=b/*p;			/* div b by ... */

the /* between the b and the p is the beginning of the comment, not
a div (/) and then a pointer (*).  and the answer i got was 10.  and that's
b/dum(a);  (anyone know why dum(a) has the value 1???)

						Goldi



More information about the Comp.lang.c mailing list