Array On C++

in used •  7 years ago 

An array is a collection of data values ​​of the same type in a particular order using a similar name. The data values ​​in an array are called array elements.
The location of the sequence of an array element is indicated by a subscript or an index.
According to its dimensions, arrays can be distinguished into:

  1. One dimensional array
    Each array element can be accessed through the index
    Index array by default starts from 0
    Declare array:
    Type_array nama_array [size]
  2. Two-dimensional array
    The two-dimensional array is an array consisting of m rows and n pieces of the form columns can be either matrices or tables.
    Declare array:
    Type_array nama_array [line] [column]

3.Array multidimensional
Multidimensional arrays are arrays of more than two sizes. The multidimensional array declaration is tantamount to the declaration of one-dimensional or two-dimensional arrays.
Declare array:
Type_array nama_array [size 1] [size 2]. . . [N size]

Difference array with other data types:
Arrays can have a number of values, while other data types are only associated with a value only.
Arrays can be used to store multiple values ​​of other data types of data (char, int, float, double, long, etc.) that are the same as one name only.
In addition, arrays can be one or more dimensions, whereas other data types are only one dimension.

Arrays can also be used as parameters. Type:
a. One dimension array as parameter:
-Delivery of parameters in the form of one-dimensional arrays is a reference by reference, since the address is the address of the first element of the array, not all of its element values. The address of the first element of the array can be indicated by the name of the array that is not written with the index.

b.Array two dimensions as parameters:
-Delivery of parameters in the form of a two-dimensional array is almost identical to the delivery of one-dimensional array parameters, except that the difference is in a two-dimensional array should mention the row and column of the two-dimensional array, declare MAX_ROWS and MAX_COLS used for the delivery of two-dimensional array parameters and upon delivery formal two-dimensional array parameters, we should mention the number of array dimensions for columns, so the column size can be known, this is related to the ordering of array variables in memory.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!