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

How do you write a function that can reverse a linked-list?

579


Should I learn c or c++ first?

572


What are c++ variables?

542


If you don’t declare a return value, what type of return value is assumed?

544


Can class objects be passed as function arguments?

612






What is scope resolution operator in c++ with example?

563


what is upcasting in C++?

727


If there are two catch statements, one for base and one for derived, which should come first?

585


What is the use of register keyword with the variables?

556


What is the difference between #define debug 0 and #undef debug?

652


What is the latest c++ standard?

691


How do you clear a buffer in c++?

546


Who invented turbo c++?

609


What do you mean by “this” pointer?

621


What is function prototyping? What are its advantages?

597