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
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
What is the full form of dos?
You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()
What is friend class in c++ with example?
Can a function take variable length arguments, if yes, how?
What relational operators if statements in c++?
What is the use of function pointer?
Is map sorted c++?
Define friend function.
In the derived class, which data member of the base class are visible?
Implement stack operations with pointers with appropriate exception checks.
Is linux written in c or c++?
How do you generate a random number in c++?
Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.
What are the advantages of using pointers in a program?