90.1k views
16 votes
Why is it better to organize information using an array instead of simple variables

User Rohit
by
3.4k points

2 Answers

5 votes

Answer: It reduces the amount of code used in the program.

Step-by-step explanation:

Why is it better to organize information using an array instead of simple variables-example-1
User Bryan Migliorisi
by
3.3k points
2 votes

Step-by-step explanation:

Arrays can hold multiple values. This means that if your array has the values of 'cat', 'dog', 'bird', you can access them easily by stating the location. For example, if I wanted to find 'cat' I would use: arrayName(0) and it would give me 'cat'. This is better than using individual variables because if you have a lot of values, creating variables for each value can be unorganized and very inefficient.

User Nate C
by
3.6k points