Add inversion-variables
This commit is contained in:
parent
1822496295
commit
f345891be9
1 changed files with 21 additions and 0 deletions
21
programmation-c-cpp/tp4/inversion-variables.c
Normal file
21
programmation-c-cpp/tp4/inversion-variables.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* Inversion de variables */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
char prenom = 'A', nom = 'Z', tmp;
|
||||
|
||||
char *p_prenom = &prenom;
|
||||
char *p_nom = &nom;
|
||||
|
||||
printf("vos initiales : %c.%c\n", prenom, nom);
|
||||
|
||||
tmp = *p_prenom;
|
||||
prenom = *p_nom;
|
||||
nom = tmp;
|
||||
|
||||
printf("vos initiales : %c.%c\n", prenom, nom);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue