What are array..?how do we use them? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are array..?how do we use them?

7th Feb 2017, 8:59 AM
yatharth jain
2 Answers
0
array is a variable with more than 1 piece of data stored in it e.g in PHP $numb = 100 now an array could store more than just one value, it could store [100,200,300]. Also it can be indexed so you can programatically access any value in the array. Just remember arrays start with index 0, so to acces 200 in my example would be [1] not [2], start counting from 0.
7th Feb 2017, 9:30 AM
Andre van Rensburg
Andre van Rensburg - avatar
0
Array : when you need number of variables...For example If you need To store mark of 60 student...So it is more difficult to Declare 60 variable and store value...So array Maintain a relationship between All variable (using index) and Can be declare easily...! Array alwayz Contaim the similar datatype variable as declare... syntax Data_type Array_name[Array_size] ; Now using for loop you can Take input from keyboard Into your array..:) array always require Continuous free memory for indexing Purpose...:)
7th Feb 2017, 12:19 PM
Shreyance Gupta
Shreyance Gupta - avatar