WEBVTT

00:00.530 --> 00:07.430
We haven't talked much about memory this far but I want to talk about it here because it will be the

00:07.490 --> 00:10.150
theme of the next three sections.

00:10.190 --> 00:17.960
We talked earlier that variables have a location in memory which is accessed by their name or identifier.

00:18.290 --> 00:23.570
Well we can think of memory being like a big long list of memory cells.

00:23.570 --> 00:29.690
Each one byte and size and each one with its own unique address.

00:29.690 --> 00:34.360
Each cell can be located in memory using this unique address.

00:34.550 --> 00:41.140
So the address 1001 would be right after the address 1000.

00:41.480 --> 00:47.670
So in my mind I have a picture of what a cell really looks like.

00:47.660 --> 00:52.430
In fact this is kind of how I think of variables in general.

00:52.430 --> 01:03.290
So we have this kind of first slot which is the address portion says a beer one thousand one or 1000

01:03.290 --> 01:05.870
or whatever the address may be.

01:05.870 --> 01:19.080
And then here you have the value of what it is say we made some kind of X equals to 5 like this.

01:19.480 --> 01:22.470
Well this index has an address of some kind.

01:22.470 --> 01:27.800
We don't know exactly what that is but the value would be five year right.

01:29.740 --> 01:30.440
OK.

01:30.970 --> 01:38.650
So of course different types have different sizes so an integer would be for these cells but really

01:38.650 --> 01:45.400
I just think of it as one big cell with an address and one value.

01:45.400 --> 01:52.210
So remember that there are no guarantees where your variables are stored but we can actually get the

01:52.210 --> 01:53.920
address of a variable.

01:53.920 --> 01:57.400
So let me just show you how to do that.

01:57.610 --> 02:00.220
So we have our variable x.

02:00.250 --> 02:05.140
And if we just say seek out the address

02:07.570 --> 02:11.400
X is in.

02:11.520 --> 02:22.290
We do this we say ampersand and X and if we run this you'll see what the address is.

02:22.290 --> 02:27.300
So it's this big long bizarre kind of looking thing.

02:27.900 --> 02:30.560
Those those if you've seen this before.

02:30.560 --> 02:32.410
No this is hexadecimal.

02:32.550 --> 02:43.570
K so this single edge ampersand is known as the address of operator and we can do this with any variable

02:43.570 --> 02:45.070
to get its address.

02:45.070 --> 02:49.030
So here this is actually just an integer

02:51.970 --> 03:01.870
but know that the address is not considered an integer type so we don't really know what the type is

03:01.870 --> 03:05.440
yet but we'll see this in the next lecture.
