#Compile and run with VScode help
29 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
?
Hi guys
I just needed some help on something regarding running the code on C++
When I run it on VScoce a bar at the top appears with 3 options
I picked one of them
it is called clang
Ok thanks
@frozen moss Has your question been resolved? If so, type !solved :)
Not yet
#include <iostream>
#include <list>
#include<string>
using namespace std;
int main(){
int banana[5] = {1,2,3,4,5};
for (int i; i < 5; i++){
cout<< banana[i];
}
}```
Why is it highlighted yellow
@half pollen
nvm I got that fixed
the value of i could be anything here at the start
you need to properly initialize your intergers
int i=0
i is every individual value in the array
it iterates through eachone
and it would return 12345
except it's not the initial value of i is not zero
since it's not initialized it could be -3976
you need to explicitly initialize intergers for them to have a well defined value