weird C behavior

Bernie Roehl broehl at watdcsu.UUCP
Wed Mar 26 04:47:21 AEST 1986


In article <436 at umcp-cs.UUCP> chris at umcp-cs.UUCP (Chris Torek) writes:
>
>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.



More information about the Comp.lang.c mailing list