|
|
ArraysYou have been discussing variables, where only one piece of data is used. In real life, one deals with a range or collection of data or values. How do we handle a collection of values?A collection of values can be handled using arrays. What are arrays? Arrays allow us to handle a collection of values. Arrays allow us to refer and to manipulate the values as a collection and as individual values. Could you define arrays in a different manner? You can think of arrays as a labeled and numbered list, or as a matrix. There are one dimensional and two dimensional arrays. Two dimensional arrays are used to implement matrix, and will not be discussed. How does an array get implemented in C? An array can be implemented by One important thing to note is that the array index always starts with zero. Thus, the maximum array index is always one less than the array size. Consider the following example for the exact syntax. /* Project: Lab6 */ /* File: array.C */ /* Aim: Numeric Array */ /* Keywords: for */ #include
|