Help me out?

Why do I get this error in Visual studio but not when i try to run the code on an online C compiler, I even tried submitting my code through Matrix and it works completely fine. Can anyone help me out?
No description
No description
10 Replies
smb
smbOP2y ago
Oh and in the pictures it shows the code errors and the lines where the error is i realized these screenshots aren’t great, Let me know if i should send more
constant change
Did you try saving it then turning off vs code then turning it on?
gr8b8m8_2l8
gr8b8m8_2l82y ago
VS uses its own compiler, online is probably using gcc, which is the same as matrix
Eakam
Eakam2y ago
I would check where wishlisiItems is defined
gr8b8m8_2l8
gr8b8m8_2l82y ago
int x;
printf("Enter a number: ");
scanf("%d", &x);
double y[x];
int x;
printf("Enter a number: ");
scanf("%d", &x);
double y[x];
This is legal in C, his compiler is saying its not At least with gcc
Eakam
Eakam2y ago
Yea, I am assuming it can't see wishListItems
gr8b8m8_2l8
gr8b8m8_2l82y ago
Error is saying expression must be a constant value Actually If those are not inside a function that error is correct
smb
smbOP2y ago
wishListItems is defined at the top using int like this: int wishListItems;
Eakam
Eakam2y ago
And do you set it to a value anywhere?
smb
smbOP2y ago
nope no value but we enter in when we run the code
Want results from more Discord servers?
Add your server