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](https://cdn.answeroverflow.com/1119516528698732644/image.png)
![No description](https://cdn.answeroverflow.com/1119516529021698069/image.png)
10 Replies
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
Did you try saving it then turning off vs code then turning it on?
VS uses its own compiler, online is probably using gcc, which is the same as matrix
I would check where wishlisiItems is defined
This is legal in C, his compiler is saying its not
At least with gcc
Yea, I am assuming it can't see wishListItems
Error is saying
expression must be a constant value
Actually
If those are not inside a function that error is correctwishListItems is defined at the top using int like this:
int wishListItems;
And do you set it to a value anywhere?
nope
no value
but we enter in when we run the code