I want to know ,the different between 'array' and 'object' and how to use them? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

I want to know ,the different between 'array' and 'object' and how to use them?

18th Feb 2016, 1:24 PM
Myo Min San
Myo Min San - avatar
5 Answers
+ 2
array is an object and when you instantiate a new object (for example person) you put new keyword at begin. Arrays in some languages are yet declared from syntax and have some methods inside (length for example).
3rd Apr 2016, 9:08 AM
Antonio Daniele Mu
Antonio Daniele Mu - avatar
+ 7
an object is something with attributes. an array is a data structure used to store stuff. example. you can have multiple objects with similar types of attributes all stored in an array for later use. //pseudocode class Person //attributes name age birthplace //create a few instances of Person new Person = myPerson new Person = myOtherPerson //once you set their attributes you can store in an array, although keep in mind some languages need you to be precise on what is being stored in the array... int or string. in this case we are storing Person. //the number within the braces is the index. sometimes we may have to use predefined functions to resize our array otherwise we get a seg fault or a runtime error. new Array = Person myArray [] myArray[0] = myPerson myArray[1] = myOtherPerson hope this helps!
5th Mar 2016, 8:49 AM
Jesus Chavez
Jesus Chavez - avatar
+ 4
an array is a special type of object an array uses no's to access its elements while object uses names to access its eleme
15th Jul 2016, 11:31 AM
Afzaal Arif
Afzaal Arif - avatar
+ 3
Thank you very much, Jesus Chavez, Afzaal Arif and Antonio Daniele Mu!
9th Dec 2017, 5:27 PM
Myo Min San
Myo Min San - avatar
+ 1
Very helpful comments
19th Apr 2018, 1:05 AM
Baribor Saturday
Baribor Saturday - avatar