Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,940 --> 00:00:10,290
All right, welcome back, ladies and gentlemen, to a very important video about these exclusive tapes
2
00:00:11,040 --> 00:00:17,520
that basically what I want to do, this video, is simply to give you this information that took me
3
00:00:17,520 --> 00:00:19,950
so long to gather and organize.
4
00:00:20,550 --> 00:00:28,770
It's sort of a cheat sheet that will help you to prepare for your next exam or interview or even like
5
00:00:28,770 --> 00:00:36,060
to get yourself to a new level without getting lost with all of these constant definitions.
6
00:00:36,100 --> 00:00:47,580
OK, so to be honest, it's quite not so trivial at first at least, you know, a lot of tutorials to
7
00:00:47,580 --> 00:00:54,960
learn these differences between using constants and how they can be used with pointers and so on these
8
00:00:54,960 --> 00:01:03,120
definitions, because the usage of constants, the syntax in some constellations is very and I mean
9
00:01:03,120 --> 00:01:05,170
very difficult to understand.
10
00:01:05,670 --> 00:01:13,740
So I've done this video to make this life much easier for you and to understand everything from a hopefully
11
00:01:13,740 --> 00:01:15,320
to Y or Z.
12
00:01:15,720 --> 00:01:17,760
So let's get started.
13
00:01:21,030 --> 00:01:28,250
OK, and the first thing that I want to talk about is the default usage of constants in C language.
14
00:01:29,040 --> 00:01:34,030
This refers to the default usage of constants and basically it is the same.
15
00:01:34,040 --> 00:01:38,020
OK, if you've written just const age equals to you 35.
16
00:01:38,490 --> 00:01:40,590
OK, so if you've written it this way.
17
00:01:40,800 --> 00:01:50,070
OK, so it simply assumes that you've written and created a variable of an integer type unless of course
18
00:01:50,070 --> 00:01:52,230
otherwise was specified.
19
00:01:52,560 --> 00:01:59,550
So if you will see some exercises or in some solutions or basically in some examples, just const age
20
00:01:59,550 --> 00:02:02,010
without seeing that type itself.
21
00:02:02,310 --> 00:02:07,440
So you can assume that that's the default usage of constants in C and behind the scenes.
22
00:02:07,440 --> 00:02:11,990
It's just like it was written const and age equals 35.
23
00:02:12,510 --> 00:02:21,840
And basically what was created here is just the variable of of simply an integer type, which is constant
24
00:02:21,840 --> 00:02:24,330
and it cannot be changed over time.
25
00:02:25,910 --> 00:02:26,430
Awesome.
26
00:02:26,450 --> 00:02:31,850
So write down this note also for yourself and let's proceed to the second option.
27
00:02:32,390 --> 00:02:36,600
The second option goes like this const and star BTR.
28
00:02:37,580 --> 00:02:42,740
OK, so what we do here is we create a pointer to a constant.
29
00:02:42,950 --> 00:02:48,260
OK, so a pointer to a constant with me droid maybe a little bit one sec.
30
00:02:49,010 --> 00:02:51,260
But Bob, let's go like this.
31
00:02:51,520 --> 00:02:52,130
The pan.
32
00:02:53,120 --> 00:02:53,750
What's going on.
33
00:02:53,780 --> 00:02:54,230
Oops.
34
00:02:54,440 --> 00:02:55,860
What's happening.
35
00:02:56,360 --> 00:02:57,660
OK, so there is the Bam.
36
00:02:57,680 --> 00:03:08,510
So we created a variable called BTR and this variable is assumed to point to some value to some other
37
00:03:08,510 --> 00:03:09,530
place in memory.
38
00:03:09,530 --> 00:03:09,860
Right.
39
00:03:09,870 --> 00:03:15,440
Since it's a pointer and these value that we should point to.
40
00:03:17,000 --> 00:03:19,880
Could not be changed through these point.
41
00:03:20,600 --> 00:03:21,650
What do I mean by that?
42
00:03:23,980 --> 00:03:32,620
So we have a pointer to some constant that is of an integer type and any attempt to change or to modify
43
00:03:32,620 --> 00:03:38,850
the content of the place we are pointing to will result in a compilation error.
44
00:03:39,520 --> 00:03:43,920
So make sure you understand the pointer itself is not a constant.
45
00:03:43,930 --> 00:03:46,240
OK, these pointer is not a constant.
46
00:03:46,240 --> 00:03:47,020
What is a pointer?
47
00:03:47,020 --> 00:03:52,020
It holds the address of some or some other data in memory.
48
00:03:52,030 --> 00:03:54,190
OK, maybe like I don't know, four thousand.
49
00:03:54,500 --> 00:03:55,530
OK, the address.
50
00:03:56,050 --> 00:04:00,250
So the pointer itself, the highest value of BTR, it may change.
51
00:04:00,290 --> 00:04:04,510
OK, it may one time point to here and one time point to there.
52
00:04:04,630 --> 00:04:09,760
OK, there is no problem that these value will be changed to three thousand for example.
53
00:04:10,720 --> 00:04:13,960
But there is no basically problem with that.
54
00:04:14,080 --> 00:04:22,240
But the place or the constant integer we are pointing to cannot be changed.
55
00:04:22,450 --> 00:04:23,620
So something like that.
56
00:04:24,590 --> 00:04:25,120
Awesome.
57
00:04:25,160 --> 00:04:31,360
So now let us see an example that may also make things a little bit easier for us.
58
00:04:31,820 --> 00:04:33,100
So an example.
59
00:04:33,110 --> 00:04:34,850
Here we go.
60
00:04:36,690 --> 00:04:46,080
OK, so let's start and start and start Bidya const BTR equals the address of age.
61
00:04:46,680 --> 00:04:52,530
So simply here we created a constant pointer that points to a variable called H.
62
00:04:53,250 --> 00:04:59,790
OK, and now we try to modify the value of age where we point to and not the actual pointer.
63
00:04:59,790 --> 00:05:00,020
Right.
64
00:05:00,030 --> 00:05:00,930
We do not point.
65
00:05:01,500 --> 00:05:04,140
We do not change the value of PGR itself.
66
00:05:04,620 --> 00:05:07,620
We try to change the value of where we are pointing to.
67
00:05:08,310 --> 00:05:18,420
And if we go back, we can see that this declaration of Ayinde Star const PGR in star const BTR is basically
68
00:05:18,420 --> 00:05:18,800
OK.
69
00:05:18,810 --> 00:05:23,400
It allows us to modify the value where we point to OK, not the actual pointer.
70
00:05:23,400 --> 00:05:25,260
So there is no problem in that.
71
00:05:25,740 --> 00:05:35,310
But we said that if we will try to modify the BTR value itself, the value of the variable itself,
72
00:05:35,310 --> 00:05:41,550
the value of the pointer itself, that's basically will result in a compilation error.
73
00:05:41,970 --> 00:05:44,010
OK, so I hope that's clear.
74
00:05:44,010 --> 00:05:49,370
And it basically concludes the first three options that we've just seen.
75
00:05:50,550 --> 00:05:52,230
And yeah, awesome.
76
00:05:52,240 --> 00:05:54,810
So let's proceed with the last one.
77
00:05:54,850 --> 00:05:58,660
I think basically it will be clearer to you.
78
00:05:58,680 --> 00:06:00,690
OK, so that's the last one.
79
00:06:00,690 --> 00:06:02,850
The fourth where it is.
80
00:06:02,860 --> 00:06:04,190
So here it is.
81
00:06:06,870 --> 00:06:07,560
Here it is.
82
00:06:07,560 --> 00:06:11,520
How we create a const and star const BTR.
83
00:06:11,820 --> 00:06:16,860
So basically we create a constant pointer pointing to constant integer.
84
00:06:17,310 --> 00:06:17,670
OK.
85
00:06:20,310 --> 00:06:28,320
That's a combination of the previous both constants right here and basically we have our appointer constant
86
00:06:28,320 --> 00:06:32,540
pointer pointing to a constant integer, nothing can be changed.
87
00:06:32,550 --> 00:06:36,090
Neither the pointer nor Warith points to, OK.
88
00:06:36,180 --> 00:06:43,500
So basically, you if we created some PDR to point to numb, then neither of them can be change, nor
89
00:06:43,530 --> 00:06:49,400
this one that BTR itself, neither the variable or the constant value where pointing to.
90
00:06:50,340 --> 00:06:50,570
OK.
91
00:06:50,610 --> 00:06:57,420
So basically these steps are really important because a lot of times people and my students and also
92
00:06:57,420 --> 00:07:02,850
I know that other students do they find really difficult to understand.
93
00:07:02,850 --> 00:07:06,510
What is the difference between this one and why do I have problems when I'm using this one?
94
00:07:06,510 --> 00:07:07,690
And what is that one?
95
00:07:08,100 --> 00:07:13,520
So now I think everything is clear to you guys and you are basically ready to proceed.
96
00:07:13,530 --> 00:07:15,240
You are basically ready to move on.
97
00:07:15,720 --> 00:07:17,490
And yeah.
98
00:07:17,880 --> 00:07:19,820
So I think we've covered it up.
99
00:07:19,830 --> 00:07:23,580
The top uses are used cases with constants and pointers.
100
00:07:24,060 --> 00:07:29,280
And make sure you write down these notes because that's superimportant.
101
00:07:30,510 --> 00:07:37,260
Run some examples on your own and make sure that everything said here you understand as well as make
102
00:07:37,260 --> 00:07:41,210
some tests to make sure that everything I said is correct.
103
00:07:41,220 --> 00:07:45,000
OK, so check check it out and until next time.
104
00:07:45,000 --> 00:07:46,260
Thank you so much for watching.
105
00:07:46,320 --> 00:07:47,030
I'll see you then.
9667
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.