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

Answer Posted / brainless

b) use pointer of last element - pointer of first element + 1

However, we should know the last element's pointer...

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is there any function that can skip certain number of characters present in the input stream?

595


In a function declaration what does extern means?

606


Difference between overloading vs. Overriding

600


What is pointer with example?

571


What return value must conversion operators have in their declaration?

628






Explain object slicing in c++?

592


What is abstraction in c++ with example?

575


Why do we learn c++?

541


What's the "software peter principleā€?

635


What is an incomplete type in c++?

774


List the issue that the auto_ptr object handles?

623


what are the iterator and generic algorithms.

1696


What's c++ used for?

606


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

615


What are vectors used for in c++?

632