- #1
NeoDevin
- 334
- 2
I'm having trouble figuring out why some of my integers are behaving crazy.
I have a vector of vectors, declared as
In another function, I add a vector of three ints to it using
And later I try to print out the contents by
and it prints out
0 0 0x633d50
where the last one seems to be a random hexadecimal number, or something.
Does anyone know why this might be happening? Some of my functions seem to be evaluating the third number correctly, and give me the proper result, while others seem to evaluate it as zero, and printing it out gives me gibberish.
Any help would be greatly appreciated.
Thanks in advance,
Devin.
I have a vector of vectors, declared as
Code:
vector<vector<int> > ph;
In another function, I add a vector of three ints to it using
Code:
vector<int> p;
p.push_back(0); p.push_back(0); p.push_back(1);
ph.push_back(p);
Code:
int i;
for(i = 0; i < ph.size(); i++){
cout << ph[i][0] << " " << ph[i][1] << " " << ph[i][2] << endl;
} cout << endl;
and it prints out
0 0 0x633d50
where the last one seems to be a random hexadecimal number, or something.
Does anyone know why this might be happening? Some of my functions seem to be evaluating the third number correctly, and give me the proper result, while others seem to evaluate it as zero, and printing it out gives me gibberish.
Any help would be greatly appreciated.
Thanks in advance,
Devin.
Last edited: