Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: printf
Message-ID: <1989Oct21.070406.8684@utzoo.uucp>
Organization: U of Toronto Zoology
References: <543@uwm.edu>
Date: Sat, 21 Oct 89 07:04:06 GMT

In article <543@uwm.edu> zhao@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@zoo.toronto.edu
