X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=exo1%2Fexo1.c;h=eef51dbc61831d4219acab57f8b5e30604aa8f5b;hb=39ba1592dca861839f707facb99d315756650a43;hp=34251200207f6ef3afc6bc66f9f8e307ca55918f;hpb=0cd9f5da6c770e971c3156cabdb0d2e627338ab2;p=TD_C.git diff --git a/exo1/exo1.c b/exo1/exo1.c index 3425120..eef51db 100644 --- a/exo1/exo1.c +++ b/exo1/exo1.c @@ -54,8 +54,10 @@ void sortArray(int* array, int length) { int main() { int tab_length = 10; - // GCC do not like variable sized array, even with the size variable properly initialized - int tab[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + int tab[tab_length]; + for (int i = 0; i < tab_length; i++) { + tab[i] = 0; + } for (int i = 0; i < tab_length; i++) { printf("Enter integer value at array's index[%d]? ", i);