 Welcome to this session on arrays. With this session, we are moving into an exciting discussion on how to use arrays and matrices to handle a large number of values which often crop up in computational problems. In this lecture, we will be looking at the need for representing a set of values such that the entire set has a single name and individual elements of the set can be used in computations. An array structure is known in mathematics, so we shall look at that and we will see how elements of an array can be accessed using index expressions. First, we will look back at a program to find some of given values. Imagine that we are given four numbers whose sum we need to find out. We had done this program earlier. We just have v 1, v 2, v 3, v 4 as four integer variables, a variable for sum. We input the values of all four variables. We calculate sum equal to v 1 plus v 2 plus v 3 plus v 4 and output the sum. This is a simple program except that the question is what do we do when we have a large number of values? If we only need to find their sum, well, we can use only one location and keep on adding the new input value into that sum iteratively. In this case, we require only one location. Here is a program which finds some of marks for say n students. Suppose they have given a quiz and the quiz marks are available. I now declare only a single variable marks. I of course, declare sum with an initial value of 0. I propose to use count as an integer variable to set up a for iteration. You are familiar with the for iteration. n is the number of marks or number of students whose marks I wish to add. I input the value of n and I set up this iteration. You are all familiar with this for count equal to 1, count less than equal to n, count equal to count plus 1 sets up an iteration which starts with count equal to 1 and ends with count equal to n. So, 1, 2, 3, 4, 5, 6 n times it will do this iteration. In each iteration, I read the value of marks and I immediately add it to the sum. So, sum becomes sum kind of a running sum. In fact, when the iteration control goes back to the next iteration, the next value of marks is read in the same variable. It gets added to sum. At the end, it is very obvious that sum will contain the sum of all n individual marks that have been submitted. So, whatever we achieved, we have actually succeeded in finding sum of marks of n students without having n individual variable. This works, but it works only when we need to find sum or any value based on sum such as an average. Having calculated the sum, we know that we divide it by n and we will find the average. So, we get the required result, but we lose individual value. Now, there may be occasions when we need to retain excess and use these values later. For example, suppose we need to find not just the sum, but we need to find the sum. We need to find the standard deviation of given marks for which we need the average, of course, which means that we will need to access all those elements again. Suppose we need to arrange and print all marks in descending order. We cannot throw away any mark that we have read, because after reading the mark somehow, we will have to rearrange them in descending order and print them. These are the limitations which we cannot solve using ordinary variables. We now look at the arrays as we know them in mathematics. We know when we want to represent a set of numbers. Often arranged as a table of rows and columns is called a matrix. For example, an array is nothing but a one-dimensional matrix with just one row. Now, an array A, let us say, contains some 11 integers. We may be able to write it as A equal to 73, 14, 3, 128, etcetera. These are all 11 values. Mathematically, we immediately understand that A is an array. We often use the notation A subscript i to represent the ith element of array A. Here, i is said to be an index, because it indicates a specific element of the array A. So, for example, A 2 represents the second element, which is 14. A 5 represents the fifth element 1, 2, 3, 4, 5, which is 3926. And this is how we can refer to individual elements. Observe that this mathematical structure is so elegant. It has a single name for all its elements. And individual elements can be addressed by using a subscript, which is nothing but an index to an element. For this array, we can denote the sum of n elements of such an array as sum is equal to sigma i, i varying from 1 to n. This is a typical standard mathematical notation. For example, here, if n is 4, then the sum will be nothing but the total of the first 4 elements 73, 14, 3 and 128, which works out to 280. How nice it would be if this concept of a mathematical array is made available to us as a programming construct. What we need is, see therefore, is if we can have adjacent memory locations allocated not to different variables, but allocated to different elements of an array and all the elements together are collectively referred to by a single name, say A. So, an individual element can be identified by an index like 1, 2, 3, 4, 5. In short, we look for such a facility. There are indeed arrays in C plus plus, a structure which provides a single name for entire collection and it permits us to access individual elements using an index. In a program, how do we declare an array? How do we write references to individual elements? Can we use a variable like i as an index? These are the questions that we shall see in the next session. In summary, we need an array to store a large number of similar values. We must be able to access and process individual elements. An array is indeed a collection of adjacent memory locations and an index is used to refer to an individual element. However, mathematical formulation of an array and its representation are slightly different than the C plus plus representation, but we note that C plus plus does provide us with such a data structure. We will next study the details of using C plus plus arrays. Thank you very much.