Curso de Programación en C/Prog7
Ir a la navegación
Ir a la búsqueda
Prog7
1 /* Prog7.c -- El int maximo del sistema 32-bits */
2
3 #include <stdio.h>
4
5 int main( void )
6 {
7 /* Maximos de 32 bits */
8
9 int i = 2147483647;
10 unsigned int j = 4294967295;
11
12 /* Otro tipos
13 * long int LInt;
14 * long LInt2;
15 * short int SInt;
16 * short SInt2;
17 * unsigned UInt2;
18 * unsigned long ULongInt;
19 * unsigned short UShortInt;
20 * long long LongLongInt;
21 * char Letra;
22 * unsigned char ULetra;
23 */
24
25 printf( "%d %d %d\n", i, i+1, i+2 );
26 printf( "%u %u %u\n", j, j+1, j+2 );
27
28 return 0;
29 }
Resultado
[rrc@Pridd CClase]$ gcc -o Prog7 -Wall -O2 Prog7.c Prog7.c: In function ‘main’: Prog7.c:8: warning: this decimal constant is unsigned only in ISO C90 [rrc@Pridd CClase]$ ./Prog7 2147483647 -2147483648 -2147483647 4294967295 0 1