Vector | Sololearn: Learn to code for FREE!



How to return a vector in a function

3/31/2022 11:04:07 PM

Basil Uche

4 Answers

New Answer


Your binary() function has return type `int`, so you can't return a std::vector from it. Change the return type of binary() to `vector<int>`. Also, on lines 50, 68 and 60, you are using the name `and` for your variable. `and` is a keyword in C++, so you can't use it as a variable name. Change it to something else.


Jay Matthews Sir why's the vector not returning here


My binary function