What is the difference between an array and vector?



What is the difference between an array and vector?..

Answer / Himanshu Dwivedi

An array is a data structure that stores multiple elements of any data type in contiguous memory locations, where each element can be individually accessed using an index. On the other hand, a vector is a type of array provided by C++ Standard Template Library (STL), which automatically manages the size of the array and can grow or shrink as needed.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is complexity algorithm?

1 Answers  


What is a stable sort?

1 Answers  


Write the programs for Linked List (Insertion and Deletion) operations

9 Answers   College School Exams Tests, Persistent, TCS,


What do u mean by data type?

1 Answers  


How can we reverse the order in the treemap?

1 Answers  


Why set will not allow duplicates?

1 Answers  


Which one is faster? A binary search of an orderd set of elements in an array or a sequential search of the elements.

22 Answers   Syntel, TCS,


You are given a singly linked list. How would you find out if it contains a loop or not without using temporary space?

1 Answers   TCS,


What is circular queue example?

1 Answers  


Is tuple immutable?

1 Answers  


What is difference between static and dynamic array?

1 Answers  


What is Insertion sort, selection sort, bubble sort( basic differences among the functionality of the three sorts and not the exact algorithms)?

1 Answers   TCS,


Categories