[MUSIC] Now let's turn to some actual code where our parameter will be a one dimensional array. And this will look familiar because we had one dimensional array already in Maine and we were doing the same thing. We were printing some grades and then computing an average. So we'll show how to do both things, but now we'll encapsulate as parameter the grades and we'll show why this is so effective. So, Both routines, one will be for getting the average of the grades, the other will be for printing the grades. Getting the average of the grades, we need to know how many grades, and then we're going to pass in the base address of grades. So we're going to assume that if there are ten grades then they're going to be ten entries in the grades array, that everything will be of the appropriate length. That's one place where you can make an error. You can have too many for the array that you're passing in, for example. Locally we need a counting parameter, int i, and we also need a parameter for adding up the sum of the grades as before. And here again, we see this very natural idiom for i=0: i < how many because the array starts from 0. Auto increment the index, and then create the the repeated sum, so you're adding in each element. And it doesn't matter how many elements, so that's why again, so powerful to use a programming language that lets you work with as much data as you want with relatively small code if you use these forms, these idiomatic forms of iteration. And then at the end because you have a sum over a integer and we have a double divided by an integer, we do return a double. Our second routine, the print grades routine, is even simpler. Again, same setup. We have how many that we want to process, we pass in the grades. We have our counting variable internally to the procedure. Then I'm going to print I have this many grades, and then I'm going to with a tab separated format string print out those grades. And again, as many as we want can be printed out. And now the logic becomes very simple, in Maine rather than having embedded everything there, these can be reused time and again with different routines. In fact, they can get us an average, as you'll see one of the problems, homework problems is to do an average for the weight of elephant seals. And here we've created the array, we called it grades, we could have called it data, we could have called it my grades. We pass it in with its how many parameters size. And then internally we print the grades out, and in the second line we figure out the average, the average grades, all very clear. So just get used to writing simple functions in which a parameter is your array, and you have a very powerful tool set for handling large amounts of data. [MUSIC]