THIS IS ONE OF THE NEATEST THINGS ABOUT ARRAYS

[0][1][2][3][4][5][6][7][8][9]

With all of these slots able to take a value of the type specified upon creating the array. The array, when you reference one of these locations, actually will work with that specific place in memory and modify that corresponding value. This is one of the neatest things about arrays!

However, beyond that, they just have raw utility. That function, being based off of pointers, isn’t totally necessary until you start working with passing arrays between functions, where you’ll have to send pointers to values, and things can start to get a little dicey.

We talked about how arrays are useful for creating rudimentary data sets, and this remains true. Let’s talk about how we can use arrays to do the same thing we were trying to do earlier in the book and set up a rudimentary gradebook.

Much like establishing a normal value, we don’t need too much information in order to set up an array. All that we need, in fact, is the type and the size of the array that we’re wanting. If we want an array which holds 10 values, then we can use that in order to initialize the array.

Create a new file with an empty shell and in the main function, type the following:

Popular posts from this blog

WELL YOURE ABOUT TO FIND OUT

Note Mac users see the end of this book