0
What is array?
Can anyone explain the word Array to me? I don't understand.
4 Antworten
+ 1
Arrays are used to store multiple values in one, single variable.
Declaring an array and defining the variable type stored in it:
String [] fruits;
Inserting values in it:
String [] fruits = {"apple", "pear", "plum"};
+ 2
Arrays are derived datatypes which are used to stores the values of variable similar datatypes.
Arrays are also called linear data structure because in array the values or the data is stored one by one i.e. linearly.
the arrays are accessed by their index ,the indexing starts from 0 i.e. if you want to store the value at 1st position then you have write
the index at that position .
Syntax (in c & c++)=
data_type name[size];
example =
int arr[10];
+ 1
It's a series of elements of the same type
+ 1
array stores elements, and you can address each of it
if elements are numbers:
array = {0,1,2,3,4,5}
array[2] = 10 change element 2 in order (count from 0) to 10
now
array = {0,1,10,3,4,5}