KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
On the 2nd for-loop, I get the following error from gcc: error: expected unqualified-id before 'int' I'm not sure what I'm missing. I've looked over documentation for how a for-loop should look and I'm still confused. What's wrong here? #include <iostream> #include <vector> int main() { std::vector<int> values; for (int i = 0; i < 20; i++) { values.push_back(i); } std::cout << "Reading values from 'std::vector values'" << std::endl; for (int i = 0, int col = 0; i < values.size(); i++, col++) { if (col > 10) { std::cout << std::endl; col == 0; } std::endl << values[i] << ' '; } }
Tags (comma-separated)
Save Edits
Cancel