Supplément exercices cours
This commit is contained in:
parent
0c9e48cc41
commit
d26fff3644
2 changed files with 34 additions and 0 deletions
23
P84.c
Normal file
23
P84.c
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/* Allocations dynamiques */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void init(int *tab, int n) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
tab[i] = i;
|
||||||
|
printf("tab[%d]=%d\n", i, tab[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int i, n, *tab;
|
||||||
|
printf("Saisissez n : ");
|
||||||
|
scanf("%d", &n);
|
||||||
|
tab = (int *) malloc(n * sizeof(int));
|
||||||
|
init(tab, n);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
11
P86.c
Normal file
11
P86.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* Arguments */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < argc; i++) {
|
||||||
|
printf("argv[%d]=%s\n", i, argv[i]);
|
||||||
|
}
|
||||||
|
}
|
Reference in a new issue