 Let's take another look at part of the program from the previous video. When these variables get allocated, the names are associated with a memory address. For n items, it's the address of the value 4. For numbers, it's the address where the array starts in memory. What happens when we call the display array function? Two local variables get created. Let's look at what happens with n items first because it's what we've seen before. The value of the argument is copied into the parameter, which has its own memory address. What happens to the numbers array? What does not happen is copying the whole array into a new memory location. That's because, as we said in a previous video, C was designed with a scarcity model where memory was limited and processors were slow. Copying an entire array, which might have hundreds of entries, would take up too much memory and be far too slow. Instead of copying the entire array, C copies the memory address of the array, which only takes a few bytes and is really fast. Effectively, the data and numbers variables are both sharing the same memory area. That means, for example, when index is zero, data subindex retrieves the value that's stored in the numbers array. This memory sharing has another important consequence. Let's look at the full program again. We'll take this code for calculating the cubes of the array elements and put it into a function of its own called cube array. We'll pass the array to it and the number of items. Here's the function. It's a void function. The name will have an inter-array called data and a constant integer and items as the parameters. The function body will be the loop that cubes the array elements. I've changed the loop variable from index to i so I can fit the code onto the slides in the later part of this video. Let's build the program and see what happens when we run it. The program still works. The array contents have changed. You might be remembering the video about call by value and wondering, wait a minute, you told us that c copies the values of the arguments to the parameters and the original value isn't modified. But in this program, I'm passing the array into a parameter and the function was successfully able to update the array elements. Was I lying to you? No, I wasn't. Let's look again at the cube array function and its call. Because the argument is an array, its memory address gets copied to the parameter and again the data variable in the function is sharing the memory with the numbers array in main. When the loop variable i is zero, data sub i times data sub i times data sub i will work out to seven times seven times seven and the result, 343, is stored in element zero of the data array, which is the numbers array. And the same thing happens for the rest of the elements in the array. Call by value hasn't been violated. The array is still at the same memory address. In fact, we never changed the address that was stored in data. We changed the data in the array that they both refer to. The important point is that an array argument passes the value of its memory address to a parameter. This is good news and bad news. The good news is that this memory sharing saves space and time and it lets the function change the contents of an array that's passed to it. The bad news is that you have to be careful when you pass an array to a function because you can change its contents even if you didn't want to. Is there a way to avoid the bad news to prevent yourself from accidentally changing an array's elements? Yes, there is. For example, in this function we only want to look at the elements in the array. We don't want to change them even accidentally. Here's what you do. When you declare the array, you add the keyword const. Now you have a constant integer array. And the compiler will make sure that you don't change any of the values in the array. If I build the program now, there are no errors. I'm retrieving the elements of data, but I'm not changing them. If I were to accidentally do something like this, to try and increment the values of the array and then try to build the program, the compiler would tell me I can't do that and it would give me an error. In summary, an array argument passes the value of its memory address to a parameter. That means that the parameter and argument share the memory where the array resides. This allows you to modify the elements in an array, but you can declare an array parameter to be a constant to have the compiler make sure that you don't accidentally change the array elements.