What & Why Array? How Sequential Data Stored in Computers?

  • Whenever we want to work with large number of data values, we need to use that much number of different variables.
  • As the number of variables are increasing, complexity of the program also increases and programmers get confused with the variable names.


To understand the concept of arrays, consider the following example declaration.
 int a, b, c;
Here, the compiler allocates 2 bytes of memory with name ‘a’, another 2 bytes of memory with name ‘b’ and more 2 bytes with name ‘c’.

These three memory locations are may be in sequence or may not be in sequence.


Array:


There may be situations in which we need to work with large number of similar data values.

To make this work more easy,
C/C++ programming language provides a concept called “Array”.
Python: list

An array is a variable which can store multiple values of same data type at a time.

An array can also be defined as follows….
“Collection of similar data items stored in continuous memory locations with single name”.

Post a Comment

0 Comments