Page 63 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 63
Fundamentals of Data Structures
Notes 4.3 Summary
An array is a data structure that is a collection of variables of one type that are accessed
through a common name.
One-dimensional Array is defined as a finite ordered set of homogeneous elements, which
is stored in contiguous memory locations.
The first array index value is referred to as its lower bound and in C it is always 0 and the
maximum index value is called its upper bound.
Arrays with more than one dimension are called multi-dimensional arrays. Three-
dimensional arrays (and higher) are stored in the same way as the two-dimensional ones.
A two-dimensional m × n array is a collection of m.n data elements such that each element
is specified by a pair of integers (such as J, K), called subscripts.
Two-dimensional arrays are called matrices in mathematics and tables in business
applications; hence two-dimensional arrays are called matrix arrays.
The first method of representing a two-dimensional array in memory is the row major
representation in which the first row of the array occupies the first set of the memory
location reserved for the array, the second row occupies the next set, and so forth.
The second method of representing a two-dimensional array in memory is the column
major representation in which the first column of the array occupies the first set of the
memory locations reserved for the array.
4.4 Keywords
Array indexing: Array indexing refers to any use of the square brackets ([]) to index array values.
Array: An array is a data structure that is a collection of variables of one type that are accessed
through a common name.
Column Major Representation: In the column major representation in which the first column of
the array occupies the first set of the memory locations reserved for the array.
Data Type: A data type in a programming language is a set of data with values having predefined
characteristics.
Double Precision: Double precision is a computer number format that occupies two adjacent
storage locations in computer memory.
Multi-Dimensional Arrays: Arrays with more than one dimension are called multi-dimensional
arrays.
One-Dimensional Array: One-dimensional array is defined as a finite ordered set of homogeneous
elements, which is stored in contiguous memory locations.
Row Major Representation: In the row major representation, the first row of the array occupies
the first set of the memory location reserved for the array, the second row occupies the next set,
and so forth.
4.5 Review Questions
1. What is one-dimensional array? Discuss with example.
2. Illustrate the declaration of single dimensional array in C.
56 LOVELY PROFESSIONAL UNIVERSITY