Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

C++ How to write a function to check if dynamic array from class is empty?

OpenStudy (rsmith6559):

Without seeing the actual dynamic array, which is basically a vector: bool isEmpty( array ) // return true if empty // return full if it has elements { return( array.size() > 0 ? false : true ); }

OpenStudy (anonymous):

Actually if it is an std container (like std::vector or std::array) then you can simply do `array.empty()` to find out whether it is empty or not. for example: http://www.cplusplus.com/reference/array/array/empty/

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!