Wednesday 13 May 2020

Types of arrays

What is arrays :
                              An array is collection of elements where all the elements are same data type and under the same name.
Types of arrays are

  1. One -dimensional array
  2.  Two dimensional array
  3. Multi dimensional array
  1. One -dimensional array :  It is an array in which each element is accessed by using only subscript. The only one subscript represents the positions of the  elements in the array.
Declaration of one -dimensional array
       Syntax       datatype  array- name [size];
       Example:   into marks [50]
2.  Two dimensional array: It is an array in which each element is accessed by using 2- subscripts represents the positions of the  elements in the array.
     Declaration of two- dimensional  array :
    Syntax     datatype   array- name [row -size ]                                     [ column- size];
     Example:    int a[2][3];
3.Multi dimensional array:  A multidimensional array is an array of n - dimensions . 

No comments:

Post a Comment

Types of arrays

What is arrays :                               An array is collection of elements where all the elements are same data type and under the ...