Structures work exactly the same as any other data type when it comes to using them with functions.
So here this example we have our book that we defined last time and we're passing a book type by value
to this function func and doesn't do anything it's really just for illustration.
But I would run this and show you the size of a book versus the size of an integer.
So it's see this venture is four bytes.
We saw this in the second section.
And the size of the book type is 524 bytes OK.
It's it's quite a bit bigger than just a simple integer now and doing copy's which is what we would
do here we're passing a copy of a book to func and doing copies of bigger types that we make are usually
a bad idea because it not only takes more space but but it's also slower because you're copying lots
of data.
And in fact in our case here this book type the copy wouldn't even work properly since there's now there's
no there's no way you can copy an array without using something like Sturr copy.
OK so we don't actually get a real proper copy for our book.
OK.
So instead of doing what I did here what I typically do is pass trucks by reference.
OK so I'll do actually something more like this.
OK.
That way we're only passing the address of the struct which is much faster and smaller in terms of memory
footprint because now an address is probably only about 8 bytes or 4 bytes it depends on your system.
And if I don't want my functions to be able to change destructs I will pass them by constant reference
to something like this.
So that if I just want to look at the type K for I want to change a tire.
I wouldn't use Konst.
So with our Strax our own user defined types we will be passing them by reference or possibly by pointer
depends on the situation.
OK so that's the convention we'll be using when passing struts to functions and we'll look at structures
with pointers in the next lecture.