/*
A dynamic array whose size is a dynamic variable eneterd 
during the execution of the program and whose size is changed 
again during the execution of the program.
*/
#include <iostream>
using namespace std;
int main()
{
	cout << "Enter size: ";
	int* size;
	size =  new int;
	cin >> *size;
	int *b = new int[*size];
	cout << "Enter elements: ";
	for (int i = 0; i < *size; i++)
		cin >> b[i];
	for (i = 0; i < *size; i++)
		cout << b[i] << '\t';
	cout << endl;

	cout << "Enter new size: ";
	cin >> *size;
	delete [] b;
	b = new int[*size];
	cout << "Enter elements: ";
	for (i = 0; i < *size; i++)
		cin >> b[i];
	for (i = 0; i < *size; i++)
		cout << b[i] << '\t';
	cout << endl;
	delete size;
	delete [] b;
	return 0;
}
