return array

I dont understand the error in this code
1
2
3
4
5
6
7
8
9
10
11
class FlowerGarden 
{
public:
	vector <int> getOrdering(vector <int> height, vector <int> bloom, vector <int> wilt) 
    {
		int i;
		vector <int> arr[height.size()];
            return arr;
        
	}
};
Last edited on
looks like you are defining the function in the header.
i doesn't get used.
closed account (zb0S216C)
And what is the error?

Wazzak
the error is in return arr

conversion from `std::vector<int, std::allocator<int> >*' to non-scalar type `std::vector<int, std::allocator<int> >' requested

vector <int> arr[height.size()]; // variable-length array of vectors holding heights.size() individual empty vectors
should be
vector <int> arr(height.size()); // one vector of size heights.size()
Last edited on
yeah, it worked.. thnx
Topic archived. No new replies allowed.