printf() problem

Buddy Harris gharris at secola.Columbia.NCR.COM
Thu Apr 27 04:56:26 AEST 1989


In article <11657 at hodge.UUCP> jdm at hodge.UUCP (jdm) writes:
->    I fopen() the file in binary mode and used the following line
->    of code to read and print out the data:
->        printf("%x %x %x %x\n", getc(fp), getc(fp), getc(fp), getc(fp));
->    Although the order of the data in the file is:
->        92 AB 4E 33
->    printf() displays it as:
->        33 4E AB 92

This is something that I don't understand either, but apparently 
printf() evluates from right to left.  Be careful with stetements like this:

     printf("%d %d %d %d", i++, i++, i++, i++);

This evluates from right to left also.  

-- 
------------------------------------------------------------------------------
! Sleep well and dream of large women.  -  The Dread Pirate Roberds          ! 
! gharris at secola.Columbia.NCR.COM (George Harris)  Have a nice day :-)       !
------------------------------------------------------------------------------



More information about the Comp.lang.c mailing list