From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,80ae9f89712e54ee X-Google-Attributes: gid1014db,public X-Google-Thread: fee84,80ae9f89712e54ee X-Google-Attributes: gidfee84,public From: The Amorphous Mass Subject: Re: printf-problem Date: 1996/01/17 Message-ID: #1/1 X-Deja-AN: 135705604 distribution: world x-sender: robinson@black.weeg.uiowa.edu content-type: TEXT/PLAIN; charset=US-ASCII organization: University of Iowa, Iowa City, IA, USA mime-version: 1.0 newsgroups: comp.unix.osf.osf1,comp.lang.c On 17 Jan 1996, Henrik Wist wrote: > Hi Folks! > Got a little problem with printing large int's from a c-program. > Platform: Digital Alpha running DG-UX3.2 > > long int zahl; /* which is e.g. 10000500001 */ > printf("%d\n",zahl); /* gives 1410565409, which is definitly wrong */ Try printf("%ld\n", zahl); It tells printf() that you want zahl printed as a long int (ref. K&R II, page 244). /**James Robinson*********************** "If a fatal error occurs, the program should not be allowed to continue." -- Oracle Pro*C User's Guide *************james-robinson@uiowa.edu**/