//Using Arrays

#include<iostream>
using namespace std;

int main()
{
	// Array is a set of variables that use the same name.
	// This set of variables must be same data type.
	
	int a[5]; // Integer Array with the size of 5
	float b[10]; //Float Array with the size of 10
	char c[12]; // Char Array with the size of 12

	//Assigning values
	
	//Method 1
	int arr1[] = {7,8,9,4,6,5}; 	//At the time we declaring the array, we can assign values. Here, mentioning the array size is not a must.
					//Size will be automatically assigned according to the number of parameters given
	int arr2[10] = {4,5,6,1,2,6,3}; // Here Array will be created with the size of 10. 8th, 9th & 10th Indexes will be empty.
	cout << "arr1[0] = " << arr1[0] << "\tarr1[1] = " << arr1[1] << endl;
	cout << "arr2[0] = " << arr2[0] << "\tarr2[1] = " << arr2[1] << endl;


	//method 2
	int arr3[3];
	arr3[0] = 10; // We can assign values to a particular index. In C++ arrays, index numbers are staring from 0.
	arr3[2] = 30;
	arr3[1] = 40;
	cout << "arr3[0] = " << arr3[0] << "\tarr3[1] = " << arr3[1] << endl;

	//Method 3
		//In the previous methods, we created arrays Statically. Here we create arrays Dynamically.
	int *arr5 = new int(5);
	arr5[0] = 5;
	arr5[2] = 10;
	cout << "arr5[0] = " << arr5[0] << "\tarr5[2] = " << arr5[2] << endl;
	delete arr5; // When a dyanmic Array is Created, It Must be deleted manually.

	return 0;
}
