Message from C, C++ discussions

January 2020

— Ok sorry

— 

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
vector<int> v;
v.push_back(10);
for(int i:v){
cout<<i;
}

— What will be it's output?

— Why i'm getting garbage value?

— 10

— Why did you ask?

— 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?

— Hey guys any one having good channel to learn Java or python??

— Is it the full program that you run, or you removed some parts?