Curso de Programación en C/Prog90
Ir a la navegación
Ir a la búsqueda
Prog90
1 #include <stdio.h>
2 #include <string.h>
3
4 int main( void )
5 {
6 printf( "strcmp( \"A\", \"A\" ) es %d\n",
7 strcmp( "A", "A" ) );
8
9 printf( "strcmp( \"A\", \"B\" ) es %d\n",
10 strcmp( "A", "B" ) );
11
12 printf( "strcmp( \"B\", \"A\" ) es %d\n",
13 strcmp( "B", "A" ) );
14
15 printf( "strcmp( \"C\", \"A\" ) es %d\n",
16 strcmp( "C", "A" ) );
17
18 printf( "strcmp( \"Z\", \"a\") es %d\n",
19 strcmp( "Z" , "a" ) );
20
21 printf( "strcmp( \"manzana\", \"manzana\" ) es %d\n",
22 strcmp( "manzana", "manzana" ) );
23
24 return 0;
25 }
Resultado
[rrc@llawyr CClase]$ gcc -Wall -o Prog90 Prog90.c [rrc@llawyr CClase]$ ./Prog90 strcmp( "A", "A" ) es 0 strcmp( "A", "B" ) es -1 strcmp( "B", "A" ) es 1 strcmp( "C", "A" ) es 1 strcmp( "Z", "a") es -1 strcmp( "apples", "apple" ) es 0 [rrc@llawyr CClase]$