Exercice 1
Implémentation:
#include <stdio.h> main() { void P(int X, int *Y); /* Prototype de la fonction appelée */ int A,B; A=0; B=0; P(A, &B); printf("%d %d \n", A, B); return 0; } void P(int X, int *Y) { X = X+1; *Y = *Y+1; printf("%d %d \n", X, *Y); }
Exercice 2
Implémentation:
#include <stdio.h> main() { void MACHIN(int X); /* Prototype de la fonction appelée */ int A; A=2; printf("%d \n", A); MACHIN(A); printf("%d \n", A); return 0; } void MACHIN(int X) { printf("%d \n", X); X = 1000; printf("%d \n", X); }
Exercice 3
Implémentation:
#include <stdio.h> main() { void MODIFIER(int X, int *Y, int *Z); /* Prototype */ int A,B,C; A=3; B=-8; C=12; printf("%d %d %d \n", A, B, C); MODIFIER(A,&B,&C); printf("%d %d %d \n", A, B, C); return 0; } void MODIFIER(int X, int *Y, int *Z) { int T; T = X; X = *Y; *Y = *Z; *Z = T; }
Exercice 4
Implémentation:
#include <stdio.h> main() { void MANIPULER(int X, int Y, int *Z); /* Prototype */ int A,B,C; A=208; B=5; C=-34; printf("%d %d %d \n", A, B, C); MANIPULER(A,B,&C); printf("%d %d %d \n", A, B, C); return 0; } void MANIPULER(int X, int Y, int *Z) { printf("%d %d %d \n", X, Y, *Z); X = X/2; Y = Y*2; *Z = X+Y; printf("%d %d %d \n", X, Y, *Z); }