— #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> v;
v.push_back(10);
for(int i:v){
cout<<i;
}
Message permanent page
— What will be it's output?
— Why i'm getting garbage value?
— What kind of value?
try to add separators between the values
eg
cout << i << "\n";
or
cout << i << " ";
Message permanent page
— Ah wait, there's only one
— Then I have no idea, looks fine
— I'm getting garbage values, why so?