Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: printf() problem Keywords: C printf Message-ID: <10130@smoke.BRL.MIL> Date: 26 Apr 89 15:33:12 GMT References: <11657@hodge.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 9 In article <11657@hodge.UUCP> jdm@hodge.UUCP (jdm) writes: > printf("%x %x %x %x\n", getc(fp), getc(fp), getc(fp), getc(fp)); The order of evaluation of function arguments in C is unspecified. Some implementations evaluate the last argument first, others don't. Since getc(fp) has a side effect (it advances an external stream), the order of evaluation matters in this example, therefore the code is not portable. Your solution works, as would a succession of four printf() invocations each printing one getc(fp) result.