Supplément exercices cours
This commit is contained in:
parent
0c9e48cc41
commit
d26fff3644
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;
|
||||
}
|
||||
|
Reference in a new issue