C++ array help.
Page 1 of 1
TheDiggler




Posts: 564

PostPosted: Mon, 27th Jun 2016 06:11    Post subject: C++ array help.
Stupid question, have the following:
int arr[2][3] = { { 2, 3, 4 },{ 5, 6, 7 } };

size_t count = 0;
for (auto &row : arr) {
cout << row;
for (auto &col : row)
{
cout << row;
col = count++;
}
}

How do I fix this so it outputs the actual values in the array rather then the addresses?
Back to top
LeoNatan
Banned



Posts: 73193
Location: Ramat Gan, Israel 🇮🇱
PostPosted: Mon, 27th Jun 2016 19:36    Post subject:
Code:
for (auto& row : arr) {
   for (auto& col : row) {
      cout << col;
   }
}
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Programmers Corner
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group