How can you quickly find the number of elements stored in a
a) static array b) dynamic array ?

Answer Posted / murali

for static array start from highest index to lowest (
normal conditions apply*)
if dynamic array is a Container type, size() / length()
will do. if not process the nodes.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a struct time where integer m, h, s are its members?

712


Is rust better than c++?

806


How would you call C functions from C++ and vice versa?

817


Can we define function inside main in c++?

752


Define a constructor?

778






What does flush do?

747


Do vectors start at 0 c++?

727


What is the use of "new" operator?

862


What is a class template?

796


What is == in programming?

780


Eplain extern keyword?

761


How is static data member similar to a global variable?

811


Explain all the C++ concepts using examples.

898


What are the advantages of c++? Explain

775


What are c++ templates used for?

844