Reputation: 1875
I'm trying to run a c++ 2d array (pretty simple file) and it works but an error (at least I think it's an error) appears on the end.
The code for the array is;
int myArray[10][10];
for (int i = 0; i <= 9; ++i){
for (int t = 0; t <=9; ++t){
myArray[i][t] = i+t; //This will give each element a value
}
}
for (int i = 0; i <= 9; ++i){
for (int t = 0; t <=9; ++t){
cout << myArray[i][t] << "\n";
}
this prints the array properly but adds
"0x22fbb0"
on the end. What is this and why does it happen?
Upvotes: 0
Views: 700
Reputation: 506847
The code you showed is fine so far. The address printed does not seem to be printed from that part of your code. I can imagine two situations for that.
if(cout) { ... }
) and this will cause an address being printed too.It could be a totally other situation. Can you paste the code that appears after the two loops?
Upvotes: 6
Reputation: 91432
The error is not in the code you posted. do you have another cout afterwards?
the 0x22.... looks like a memory address, so specifically you might have a line that reads
cout << myArray;
somewhere.
Upvotes: 5