What is an array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is an array?

x[5]

8th Mar 2017, 5:57 PM
Syed Asghar Abbas
Syed Asghar Abbas - avatar
8 Answers
+ 3
An array is a collection of elements, each identified by at least one array index or key
8th Mar 2017, 6:24 PM
AtoMX
AtoMX - avatar
+ 3
You can see it like a furniture with unlimited size where you can store datas (box) and datas (box) inside datas (box).
8th Mar 2017, 7:15 PM
Geoffrey L
Geoffrey L - avatar
+ 3
An array is used to store a collection of data, but it may be useful to think of an array as a collection of variables that are all of the same type. Instead of declaring multiple variables and storing individual values, you can declare a single array to store all the values.
10th Mar 2017, 9:03 AM
Faizan Mushtaq Ganie
Faizan Mushtaq Ganie - avatar
+ 2
- array declaration ( type name[elements]; ) int foo[5]; - array initializer ( elements is optional ) int foo[5] = { 5, 3, 2, 1, 4 }; - get/set ( index from 0 to elements - 1 ) int v = foo[0]; foo[4] = 1;
10th Mar 2017, 11:23 AM
AtoMX
AtoMX - avatar
+ 2
Collection of similar objects... 😂 😂 😂
8th Sep 2017, 4:50 AM
Mr.ASDF
Mr.ASDF - avatar
+ 1
thnx
10th Mar 2017, 5:27 PM
Syed Asghar Abbas
Syed Asghar Abbas - avatar
0
Can anyone give me a simple example....
10th Mar 2017, 9:04 AM
Syed Asghar Abbas
Syed Asghar Abbas - avatar
0
need upvode
8th Sep 2017, 4:51 AM
Faizan Mushtaq Ganie
Faizan Mushtaq Ganie - avatar