Over 5 days this question remained in my mind "What do mean by arrays"?
Over 5 days this question remained in my mind "What do mean by arrays"?
"An array is a series of memory locations – or ‘boxes’ – each of which holds a single item of data, but with each box sharing the same name. All data in an array must be of the same data type."
BBC Bitesize - KS3 Computer Science - Arrays and lists - Revision 1
Basically an array is a variable that holds multiple values. For instance a single variable called "a" can hold a single value as in "a=1". Turning that variable into an array makes it sort of like a list of values that are accessible via that same variable name but with an index added (most arrays are zero indexed), for example a="9 5 6 3 2" gives us a[0]=9, a[1]=5, a[2]=6, a[3]=3, a[4]=2. You can also assign a value to an array index directly, for example a[4]=5 would change the value in the slot a[4] from a 2 to a 5. How you initialize and populate an array variable varies depending on which language you are using, but they all behave basically the same way.
A simple way to think about Array's is to look at an old record Juke box.
You have a series of records or CD's lined up along the selection cabinet.
When you enter the code for the CD you want, the mechanism goes to that location and loads up the CD.
An array in computer terms is a list of numbers, records, directories, etc.
Each item in the array is accessed by an index number.
Since each item is in sequence, the index is an integer number so that you can select a value from 0 to n. Note some languages use 1 to n.
You can check the entire list by setting up a FOR loop that retrieves each array item sequentially to compare values or data to the data or item of interest, such as the correct CD.
So an Array is just a list that the programmer can establish to catalog just about anything.
DAB
You can have arrays of arrays
True, but in general they are discrete identification indexed.
I always try to keep it simple.
DAB
I certainly wasn't trying to correct you, DAB. Just trying to throw in a fun fact. Any linear ordering of data for which we can perform comparison operations on the indices, so long as they are unique, probably qualifies as an array. Tough to teach this stuff because the answers for a beginner are often different from the ones we give to a more advanced student.
arrays are the combination of memory block which helps you to store data contiguously, it will very helpful in the case of iterative data interaction. By using array you can easily operate any Arduino Projects or other engineering projects in which you have to control system by using programming.