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
smb13mo 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
profectus
profectus13mo ago
Did you try saving it then turning off vs code then turning it on?
gr8b8m8_2l8
gr8b8m8_2l813mo ago
VS uses its own compiler, online is probably using gcc, which is the same as matrix
Eakam
Eakam13mo ago
I would check where wishlisiItems is defined
gr8b8m8_2l8
gr8b8m8_2l813mo 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
Eakam13mo ago
Yea, I am assuming it can't see wishListItems
gr8b8m8_2l8
gr8b8m8_2l813mo ago
Error is saying expression must be a constant value Actually If those are not inside a function that error is correct
smb
smb13mo ago
wishListItems is defined at the top using int like this: int wishListItems;
Eakam
Eakam13mo ago
And do you set it to a value anywhere?
smb
smb13mo ago
nope no value but we enter in when we run the code
Want results from more Discord servers?
Add your server
More Posts