What is Array? - Let's take it easy

Updated: Jul 9

The array is the foundational Data Structure and a list of elements.


Let's take an example:


Prashant says, he has 3 friends, and their names are Sachin, Rohit, & Tinkal.


Can we say it's a list? Yes, we can make a list of Prashant's friends.


friendsOfPrashant = ['Sachin', 'Rohit', 'Tinkal']


Basically, Prashant did nothing here but created a fancy list of his friends.


So, the friendsOfPrashant is an array, and, "Sachin", "Rohit", & "Tinkal" inside the square brackets are elements of the array.


TASK: Can you make your own array example? Let's do it, it's fun and you'll learn it more accurately. Create one here.


In most programming languages, the counts of the elements in the array begin with 0. So, for our example array friendsOfPrashant, the elements "Sachin" is at index 0, "Rohit" is at 1 & "Tinkal" is at 2.


The index of an array is the number that identifies where a piece of data lives inside the array.



Related Posts

See All

If you're an aspiring Software Engineer or Software Development Engineer, I've curated repositories categorically for independent topics required to boost yourself in this journey of becoming a Softwa

Subscribe

Thanks for submitting!