1. Why arrays #
Created Tuesday 12 November 2019
Problem/Premise: When we want to save data for working on it, it beomes tedious if a large number of variables are involved, agreed. Observations:
- It may be necessary if all are different.
- But it is stupid if all of them are similar, or if we took all of them as input(e.g maximum among n elements).
Solution: The solution to this, in the simplest way, is an array(a primary data structure), which is a contiguous space of the variable which are identified by an index. So it’s easy and intuitive.
Declaration: data_type name_of_the_array[size_required] Initialization:
- At declaration, becomes easier as Cpp develops.
- By using a loop.
Confidence Increased!!