Hi everybody! I try to create same little function with 2d vector as argument to it, but my compiler gives ununderstandable error for me. Can somebody help?
My compiler gives me a mistake in line 20, it says:
error: expected ',' or '...' before '(' token
Your line was just syntaxically incorrect. Argument should contain: variable type (vector<vector<int>>& in your case) and local variable name (vect in your case)
It may be a misunderstanding of the meaning of line 13, which led to confusion later on.
We can declare a vector like this: vector<int> a;
and a 2-D vector like this: vector<vector<int> > b;
What line 13 is doing is calling the constructor to build the new vector. That's not part of the declaration, and it doesn't make sense to put the constructor in the function definition. http://www.cplusplus.com/reference/vector/vector/vector/