An array is a simple data structure used to store a collection of data in a contiguous block of memory. Each element in the collection is accessed using an index, and the elements are easy to find because they're stored sequentially in memory.
In computer programming, an array is a collection of similar types of data. For example, if we want to store the marks of 100 people then we can create an array of the integer type that can store 100 marks.
int array = new int;
The number of values in the Java array is fixed. That is, the above array can not store more than 100 elements.
We can access the element of an array using the index number. Here is the syntax for accessing elements of an array,
// access array elements array[index]
Similarly, we can print the contents of the any ith cell with the following code:
Similarly, we can get the size of any array using the following code:
Take N integers as an input and store them in an array and then print the array in reverse format.
1 <= N <= 105
1 <= Array Elements <= 109
First line contains a single integer N
Next N lines each contains a single integer denoting the array elements.
Output N lines denoting the reverse of the inputted array.
5 2 1 11 13 14
2 12 11
14 13 11 1 2