What is the output of the following code fragment? The code is assumed
to be embedded in a correct and complete program.
int *a;
a = new int[array_size];
int i;
for (i = 0; i < array_size; i++)
*(a + i) = i;
for (i = 0; i < array_size; i++)
cout << a[i] << " ";
cout << endl;
OUTPUT:
Complete Program Code:
#include <iostream>
using namespace std;
int main()
{
int array_size = 10;
int *a;
a = new int[array_size];
int i;
for (i = 0; i < array_size; i++)
*(a + i) = i;
for (i = 0; i < array_size; i++)
cout << a[i] << " ";
cout << endl;
system("PAUSE");
}