/*************************************************************************************************************************************/
/* */
/* T E S T D E L ' I M P R E S S I O N D E S ' long int ' S : */
/* */
/* */
/* Author of '$xtc/PrintLongInt.01$c' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 20100322103300). */
/* */
/*************************************************************************************************************************************/
#include "INCLUDES.01.I"
main()
/* Doit etre compile a avec '$Cc' afin d'activer les options "-m32" ou "_m64"... */
{
int ShortInt=1234567890;
long int LongInt1=1234567890;
long int LongInt2=1234567890123456789;
printf("format %%d Int=%d\n",ShortInt);
printf("format %%ld Int=%ld\n",ShortInt);
printf("\n");
/* Moralite : un 'int' peut etre imprime indiferemment avec "%d" et "%ld"... */
printf("format %%d LongInt1=%d\n",LongInt1);
printf("format %%ld LongInt1=%ld\n",LongInt1);
printf("\n");
/* Moralite : un 'long int' pas trop grand (c'est-a-dire representable a l'aide d'un 'int') */
/* peut etre imprime indiferemment avec "%d" et "%ld"... */
printf("format %%d LongInt2=%d\n",LongInt2);
printf("format %%ld LongInt2=%ld\n",LongInt2);
printf("\n");
/* Moralite : un vrai 'long int' (c'est-a-dire NON representable a l'aide d'un 'int') ne */
/* peut etre imprime qu'avec "%ld"... */
}
Copyright © Jean-François COLONNA, 2021-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2021-2024.