Files
DEV/DEV1.1/TP31/test.c

29 lines
492 B
C
Raw Normal View History

2025-01-07 15:07:12 +01:00
#include <stdio.h>
#include <stdlib.h>
2025-01-30 16:07:12 +01:00
void afficherTableau(unsigned short tab[], size_t taille) {
if (taille == 0) {
return;
}
2025-01-07 15:07:12 +01:00
2025-01-30 16:07:12 +01:00
if (taille == sizeof(tab) / sizeof(tab[0])) {
printf("{");
}
2025-01-07 15:07:12 +01:00
2025-01-30 16:07:12 +01:00
printf("%d", tab[0]);
2025-01-07 15:07:12 +01:00
2025-01-30 16:07:12 +01:00
if (taille > 1) {
printf(", ");
afficherTableau(tab + 1, taille - 1);
} else {
printf("}");
}
2025-01-07 15:07:12 +01:00
}
2025-01-30 16:07:12 +01:00
int main(void) {
unsigned short int tab[4] = {1,2,3,4};
afficherTableau(tab, 4);
2025-01-07 15:07:12 +01:00
return EXIT_SUCCESS;
}