Why
use arrays?
Arrays are most useful when they
have a large number of elements: that is, in cases where it would be completely
impractical to have a different name for every storage space in the memory. It
is then highly beneficial to move over to arrays for storing information for
two reasons:
- The storage spaces in arrays have indicies. These numbers can often be related to variables in a problem and so there is a logical connection to be made between an array an a program.
- In C, arrays can be initialized very easily indeed. It is far easier to initialize an array than it is to initialize twenty or so variables.
0 comments:
Post a Comment