Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site uiucdcs Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!mtuxo!drutx!ihnp4!inuxc!pur-ee!uiucdcs!mcewan From: mcewan@uiucdcs.CS.UIUC.EDU Newsgroups: net.micro Subject: Re: weird C behavior Message-ID: <10400216@uiucdcs> Date: Thu, 27-Mar-86 13:25:00 EST Article-I.D.: uiucdcs.10400216 Posted: Thu Mar 27 13:25:00 1986 Date-Received: Tue, 1-Apr-86 07:29:25 EST References: <557@utastro.UUCP> Lines: 27 Nf-ID: #R:utastro.UUCP:557:uiucdcs:10400216:000:659 Nf-From: uiucdcs.CS.UIUC.EDU!mcewan Mar 27 12:25:00 1986 >> The code contains the following [paraphrased]: >> >> printf("%d\n", 36864); >> >> On a 16 bit machine, this should read >> >> printf("%ld\n", 36864); >> > > Both are wrong on a 16 bit machine, and both will produce garbage (though > probably different garbage). What you want is > > printf("%ld\n", 36864L); > > Note the 'L' suffix; this is how you tell C that you mean a Long constant. K & R, page 180: "A decimal constant whose value exceeds the largest signed machine integer is taken to be long." Scott McEwan {ihnp4,pur-ee}!uiucdcs!mcewan Green s/m watchlizard seeks s/f/wl - object: companionship. Reply Box 23, Cynosure.