 This time, we're going to be looking at data structures and a data structure is really just a collection of related pieces of data. Maybe we're interested in having three integers and three doubles together. They're all relevant to some concept that we're working with and we'd like to collect them and maybe we even want to have lots of these things. To build one, we need to know exactly what is in that data structure and how large each element is. So, if I've got those three integers and three doubles, then I know that integers are all four bytes large and doubles are eight bytes large. So, I'd have four bytes allocated for each integer, eight bytes allocated for each double, and I'll just add all of those up. So, three times four is 12 plus three times eight is 36 overall. So, this data structure would take up 36 bytes. To actually implement this, all I'm going to do is take those six elements and lay them out in a row. So, I might have A, B, C, X, Y, Z. The doubles take up more space than the integers, but that's it. To access this thing, I really just need to know what the beginning of my data structure is, and then I know that say A is at the beginning of my data structure. B is at the beginning of my data structure plus four, because it's the second thing in my data structure. C is at the beginning of my data structure plus eight, because it's the third thing in my data structure. The first double would be four bytes farther down, and then each of the other doubles would be another eight bytes farther down. But that's it. We're really going to work with this about the same way as we did with our stack, but we won't use the stack pointer. We'll have a pointer to our data structure instead. We just have to be sure to watch out for alignment when we're building these. So not everything is going to be the same size. And some of our memory operations require some sort of alignment. This is true for any of the larger load and store operations. If we're working with halves, then the architecture will expect that you have given it an address that is a multiple of two. All of our halves involves grabbing two bytes. So the architecture just expects that you're going to give it an address that has an even number, and then it will pull in the odd number that comes after that. If you're working with words, then the architecture is going to expect an address that is a multiple of four. So it will grab, say, an address ending in zero, and then the next three bytes as well, so one, two, and three. If you wanted doubles, well, it would expect to get an address that's a multiple of eight. If your data structure only contains one type of data, all you have are integers, then this is really easy. You don't have to worry about much. But when you start mixing data types, like, say, a character array and some integers, then you might have to worry about that. You may decide to structure things differently so that you can match that alignment. Maybe stick that character array at the end because it's got an odd number of bytes in it, and the only thing we could stick after it would be something else with an odd number of bytes. But if you really did need to stick something after that character array, you could just add some 10 space at the end. It's not as efficient, but it would certainly work.