C++ Arrays

C++ Arrays

C++ Arrays :
  • An array is a collection of variables that can hold of value same type and reference by common name. It is a derived data structure.
  • Array is always holds contiguous memory locations.
  • An Array either can be integer, character, float data type (Data Type of array).
  • Array indexing is always starts from 0 to highest order to the corresponds to the last element.
C++ Contiguous memory location :


C++ Array Declaration
Data_type Array_name[arraySize];
 For example :
 int num[4] 

 Therefore, Int is a data type, num is a name of array and 4 is size of array.

C++ Array Initialization
     // declare and initialize an array
Int num[8] = {34,43,56,78,43,67,90};

 Example 1: How to displaying Array Elements

Output :