DEV/DEV1.1/TP16:Recursivite/tableau.c

22 lines
393 B
C
Raw Normal View History

2022-12-14 15:31:36 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void afficheTabRec(double tab[],int taille){
if(taille==0){
2023-01-03 11:27:42 +01:00
return;
2022-12-14 15:31:36 +01:00
} afficheTabRec(tab, taille-1);
2023-01-03 11:27:42 +01:00
printf("%.2f, ",tab[taille-1]);
2022-12-14 15:31:36 +01:00
}
int main(){
int i;
2023-01-03 11:27:42 +01:00
double *tab = malloc(15 * sizeof (double));
2022-12-14 15:31:36 +01:00
srand(time(NULL));
for (i=0;i<15;i++){
tab[i]=(rand()%1000);
}
afficheTabRec(tab, sizeof(tab));
2023-01-03 11:27:42 +01:00
putchar('\n');
2022-12-14 15:31:36 +01:00
return 0;
}