Jan 10, 2013 at 2:20pm UTC
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 Jan 10, 2013 at 2:20pm UTC
Jan 10, 2013 at 2:22pm UTC
looks like you are defining the function in the header.
i doesn't get used.
Jan 10, 2013 at 2:23pm UTC
And what is the error?
Wazzak
Jan 10, 2013 at 2:26pm UTC
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
Jan 10, 2013 at 2:29pm UTC
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 Jan 10, 2013 at 2:30pm UTC