This is going to be the last major topic of C for Everyone Part A. It's going to be the topic of how to deal with aggregate data. After we're done with this topic, you can consider yourself a serious programmer. In some sense, the major programming languages of the first two decades of the real use of computers namely the late 40s through the early 60s, had languages like FORTRAN and Al goal and these languages basically had for aggregate data, the array type. So we are going to show how to deal with the simple one-dimensional array type in the C language. Now, so far, we had multiple amounts of data. We would have to write out individual declaration. So we'd say something like int a, b, c, and so on for it has many variables as we need. Or we could say if they were somehow related to int a1, a2, a3 etc. But this too limiting. First off, if we really need to do things for very large datasets like we have to examine a colony of several thousand elephant seals is one of our homeworks, suggests to find out your average weight, we don't want to have to write out thousands of individually named variables. So it's going to be too hard to process, too limiting. Our way around this is to have the following kind of declaration. Int data square bracket, a hundred square bracket, semicolon. So as with normal declaration is a types this could be any of the standard types like double long char and identifier that should indicate what we're processing. I'm going to use a generic term and lot of my examples, data. Then a size which is an integer content. It's got to be known at this point partly because the allocation at this point would frequently be off the stack. When we performed that declaration, this is what the compiler produces for us. We get a one-dimensional array structure whose elements are data of zero, data of one data of two, data have 99. Arrays in C start at zero. Some programming languages started arrays at one but zero is the base address of this array. In some sense, data itself as an address in memory, zero means the zeroth element. So I see index really at that quote first element that you're going to use in processing whereas the last element is going to be whatever that size was. In this case it had been a hundred and minus one. So in effect, these brackets with an index perform an address computation that starts or wherever in memory we have data, normal cell like int a, it might be stuck in memory cell 2004 and that's what it refers to. But here we have two parts in the memory calculation and it's important to understand that this is a way to get what we call an address because later, we're going to talk about the relationship between array and pointer and for more sophisticated work in the c programming language, you're going to have to understand addressing and pointer. But for very simple things, indexes and arrays are straightforward abstraction. So each of these items can store an int and most machines that will be four bytes. Why is this so useful? Well, most processing is not about processing of few things. It's mostly about storing, retrieving, and processing very large datasets. Datasets are frequently in the millions. Well, look at this little for statement; for i initialized to zero or sign zero is not initialized, the signs zero, i less than some size autoincrement i, turns out we're doing a calculation here, we're summing. We're going to take the sum as the old sum plus whatever is in data. So by the time we get through that, we have added up all the data in that collection. Maybe we want to use it for an average, maybe we have other reasons to want to use it. But this doesn't matter. This one statement handles as much data as we have available to us. That's what's so powerful and consider it as the canonical idiom. Canonical idiom for treating data when stored in arrays and as long as you understand this and can make use of this, you're basically going to be a serious programmer.