array declare,initializing,1D array, 2D array

Published: 13 July 2020
on channel: Rezoana Ahmed Samira
24
0

Declaring Arrays
Array variables are declared identically to variables of their data type, except that the variable name is followed by one pair of square [ ] brackets for each dimension of the array.
one dimensional array:
one dimensional array is like a type of linear array. aacessing it's elements involves a single subscript which can either represent a row or column index.
data type_ array name_[size];
int array[5] = {1,2,3,4,5}// initializing

Initializing Arrays
Arrays may be initialized when they are declared, just as any other variables.
Place the initialization data in curly {} braces following the equals sign. 
The syntax to declare the 2D array is given below

data_type array_name [rows][columns];  
Consider the following example.
int twodimen [4][3]; 
Here, 4 is the number of rows, and 3 is the number of columns.

We will have to define at least the second dimension of the array. The two-dimensional array can be declared and initialize in the following way.
int arr [4][3]={{1,2,3},{2,3,4},{3,4,5},{4,5,6}};


On this page of the site you can watch the video online array declare,initializing,1D array, 2D array with a duration of hours minute second in good quality, which was uploaded by the user Rezoana Ahmed Samira 13 July 2020, share the link with friends and acquaintances, this video has already been watched 24 times on youtube and it was liked by 0 viewers. Enjoy your viewing!