update
This commit is contained in:
16
DEV.1.1/divers/doubleur.c
Normal file
16
DEV.1.1/divers/doubleur.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int somme(int n, int m) {
|
||||
return n+m;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int valeur;
|
||||
int* p = NULL;
|
||||
printf("Entrez un entier : ");
|
||||
scanf("%d", p);
|
||||
|
||||
printf("Le double vaut %d\n", somme(*p, *p));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
19
DEV.1.1/divers/salut.c
Normal file
19
DEV.1.1/divers/salut.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
int* p = NULL;
|
||||
p = (int*) malloc(2*sizeof(int));
|
||||
if (p) {
|
||||
printf("Entrez un entier : ");
|
||||
scanf("%d", p);
|
||||
printf("Entrez un second entier : ");
|
||||
scanf("%d", p + 1);
|
||||
printf("Leur somme vaut %d.\n", p[0] + p[1]);
|
||||
free(p);
|
||||
return EXIT_SUCCESS;
|
||||
} else {
|
||||
puts("Espace mémoire insuffisant !");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user