how do I pass a multidimensional vector to a function?
There is a two-dimensional vector of the form
vector <vector<int>> vi (n, vector<int>(m, 0));
How can I pass it to a function, for example, by reference?
0
Author: Andrej Levkovitch, 2018-03-06
1 answers
Well, if you have a function declared as
void func(vector<vector<int>>&v);
Or
void func(const vector<vector<int>>&v);
Then we pass
vector <vector<int>> vi (n, vector<int>(m, 0));
Just like
func(vi);
Or do you want to ask something else?
4
Author: Harry, 2018-03-06 10:41:19