6
Compilation séparée
- #include <stdio.h>
- int max( int x, int y ) {
- return x > y ? x : y;
- }
- #if !defined( _MAX_H )
- #define _MAX_H
- int max( int, int );
- #endif
- #include <stdlib.h>
- #include <stdio.h>
- int max( int, int );
- int main() {
- int a, b;
- printf("Enter 2 numbers at the prompt or ^Z|^D.\n");
- for( ;; ) {
- printf("\n? ");
- switch( scanf( "%d %d", &a, &b ) ) {
- case -1:
- exit(0);
- case 2:
- printf(" = %d", max( a, b));
- break;
- default:
- scanf( "%*s" ); /* swallow bad input */
- break;
- }
- }
- exit(0);
- }
Commentaires