printf

Henry Spencer henry at utzoo.uucp
Sat Oct 21 17:04:06 AEST 1989


In article <543 at uwm.edu> zhao at csd4.csd.uwm.edu (T.C. Zhao) writes:
>printf("%d"+(a),b);
>in passes compiler without any problem, what does this code mean ?

In two words, "nothing useful".  It feeds printf two arguments.  The
second is reasonably obvious.  The first is a pointer somewhere into the
string `"%d"'; for example, if `a' were 1, the pointer would point to
the `d'.  This almost certainly isn't what the programmer intended,
although it *is* legal C if `a' is between 0 and 2 inclusive.
-- 
A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
megabyte of flaming.           | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list