WEBVTT

00:00.560 --> 00:02.460
This will be a pretty short lecture.

00:02.690 --> 00:11.700
But I want to go over a another way to create user defined types and be a very simple way.

00:12.290 --> 00:16.080
And one of ways you can actually rename existing types.

00:16.080 --> 00:21.650
So how you do that is through our keyword typedef

00:24.800 --> 00:35.500
and typedef works like this so you have the keyword type def and then you place your existing type here

00:35.950 --> 00:41.670
and then space and then you have your new type name here.

00:41.900 --> 00:42.530
OK.

00:42.600 --> 00:47.610
So this is kind of the template you use to rename types.

00:47.650 --> 00:57.640
So say you want to rename and ginger to be an ID type instead.

00:57.760 --> 01:01.920
Like for books.

01:01.950 --> 01:15.740
So now I can use id type instead of integers ID type my ID in its for 7 or 8 or.

01:16.120 --> 01:26.210
OK so this is one way you can create a user defined type and you may ask why use this.

01:26.220 --> 01:29.580
What is why and why is this useful at all.

01:30.430 --> 01:37.270
And well theres two main reasons I can think of if you want to use this one.

01:37.270 --> 01:43.780
It helps with readability of your code so you can make it more expressive and follow the language of

01:43.780 --> 01:45.180
the problem better.

01:45.670 --> 01:54.490
But also number two it helps if you say if you say you want to change the type later to something else

01:54.520 --> 01:59.190
you want it to be a noun sine type unsigned int type.

01:59.360 --> 01:59.900
OK.

02:00.260 --> 02:06.030
Well I just change it here once and then all ID types will be updated.

02:06.120 --> 02:18.770
K so this is one nice way to change the readability of your code to make it more of the language of

02:18.770 --> 02:19.640
the problem.

02:21.180 --> 02:27.230
And in the next lecture I want to go over yet one more way to make your own types.
