C-Project icon indicating copy to clipboard operation
C-Project copied to clipboard

qsort.c error

Open jwzumwalt opened this issue 2 years ago • 0 comments

C does not allow a variable to define an array size. For example, in line 10-11 of qsort.c it shows... int size = 5; int a[size] = {5, 4, 1, 3, 2}; // This creates an error.

Main.c:11:4: error: variable-sized object may not be initialized 11 | int a[size] = {5, 4, 1, 3, 2};

instead, use #define size 5 int a[size] = {5, 4, 1, 3, 2};

jwzumwalt avatar Nov 01 '23 05:11 jwzumwalt