Lesson 8 – Arrays
The array is a data structure that allows the user to reserve a series of memory spaces for a specific data type.
A variable reserves a single memory space, but an array reserves a series of memory spaces depending upon the size of the array.
In this line of code, an integer type array with the name “arr” has been initialized. It means that 10 consecutive spaces of memory has been reserved with the name “arr”
Here the array has been initialized as well as assigned with the values.
Here you don’t need to specify the size of the array. It will be detected automatically by the number of entries you assign to the array.
If we want to take input in an array or print the contents of the array we need to do these operations using a loop. This has been demonstrated in the video.
Note: the first place of the array is referenced with number 0 and not 1. As the first index of the above-declared array will be referenced as “arr”.