Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qsort.c error #18

Open
jwzumwalt opened this issue Nov 1, 2023 · 0 comments
Open

qsort.c error #18

jwzumwalt opened this issue Nov 1, 2023 · 0 comments

Comments

@jwzumwalt
Copy link

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};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant