Examveda

Consider the following piece of code in C++. What does the following code implement?
#include <iostream>   
using namespace std;
int main()
{
    int *arr_vla;
    int size;
    cout<<"Enter the size of variable length array: ";
    cin>>size;
    arr_vla = new int [size];
    for (int i = 0; i < size; i++)
    {
        cout<<"Enter the integers to be inserted in the variable length array: ";
        cin>>arr_vla[i];
    }
    for(int i = 0; i < size; i++)
    {
        cout<<arr_vla[i]<<"  ";
    }
    cout<<endl;
    return 0;
}

A. Variable-length array

B. Fixed-size array

C. Dynamic memory allocation

D. Error

Answer: Option A


This Question Belongs to Data Structure >> Arrays In Data Structures

Join The Discussion

Related Questions on Arrays in Data Structures