WEBVTT

00:00.210 --> 00:07.810
Like I said before structure types work just like built in types and you can even use them with pointers.

00:07.830 --> 00:18.350
So something like this type pointer in column A pointer say.

00:19.170 --> 00:20.550
OK.

00:20.830 --> 00:23.390
And we can even get it from the

00:27.740 --> 00:29.140
pointer.

00:30.820 --> 00:32.100
New book or

00:35.930 --> 00:37.440
we it down here.

00:40.630 --> 00:47.250
And so it works exactly like any other regular Pilton type.

00:47.250 --> 00:54.930
There is one difference though and the question becomes how would you access member variables from the

00:54.930 --> 00:57.630
pointer k.

00:57.700 --> 01:03.900
So let's say we wanted to access the year from the book pointer.

01:03.900 --> 01:17.480
Well here's how you do it one way you do it is remember we use the dereference operator the star K and

01:17.540 --> 01:26.560
I'm putting these into parentheses because we have to dereference just the book pointer and then you'd

01:26.560 --> 01:34.800
press dot K and then you could access your K.

01:35.030 --> 01:35.980
You can do this.

01:35.990 --> 01:43.220
But there's an easier way because this is a bit cumbersome to do every time you have to kind of put

01:43.220 --> 01:47.980
it in parentheses and have that dereference and use that dot operator.

01:47.980 --> 01:49.350
It's all kind of messy.

01:49.370 --> 01:50.040
OK.

01:50.330 --> 01:54.230
So instead of what you can do is do this.

01:54.280 --> 02:02.740
So book winter in have this arrow and then access the year

02:05.430 --> 02:06.300
k.

02:06.490 --> 02:10.480
So these two are actually equivalent.

02:10.510 --> 02:12.460
These are the same thing.

02:12.610 --> 02:13.160
OK.

02:15.230 --> 02:19.940
And so what this is doing is really two things.

02:19.940 --> 02:28.640
It's referencing the pointer and also accessing the member variable of the structure all in the same

02:30.150 --> 02:34.520
or all in one kind of little piece of syntax.

02:34.650 --> 02:44.450
This this erro so you can use either version but I tend to prefer the arrow because oftentimes I don't

02:44.450 --> 02:46.070
want to write this right.

02:46.070 --> 02:48.300
This is kind of ugly.

02:49.220 --> 02:55.280
So talk about some different ways you can make it easier to find types in the next lecture.
