Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,180 --> 00:00:06,960
So in this video, we are going to see water comments and how we can use them in a C programming language.
2
00:00:07,170 --> 00:00:12,240
So here we have our previous exercise where we printed Alphatech, the screen.
3
00:00:12,660 --> 00:00:18,360
Let's say that it's the same as the program where we printed the full name, the first name and the
4
00:00:18,360 --> 00:00:19,020
last name.
5
00:00:19,050 --> 00:00:21,060
Let's say that it's pretty much the same.
6
00:00:21,060 --> 00:00:23,490
Alphatech is the first name and the last name.
7
00:00:23,730 --> 00:00:30,000
Now we can simply add a comment that specifies in just one sentence what this program does.
8
00:00:30,360 --> 00:00:36,270
For example, adding a comment like this program brings out our first and last name.
9
00:00:36,510 --> 00:00:41,070
And if we would try to run this code, then we can see that it won't work.
10
00:00:41,130 --> 00:00:43,170
We'll just get some errors.
11
00:00:43,440 --> 00:00:45,570
And the reason for that is very simple.
12
00:00:45,930 --> 00:00:47,560
We didn't specify there.
13
00:00:47,670 --> 00:00:54,180
This particular line where we say that these program prints out first name and last name, that this
14
00:00:54,180 --> 00:00:55,200
line is a comment.
15
00:00:55,590 --> 00:01:02,340
We didn't specify that if we'll live it this way, then our computer will think of this line as some
16
00:01:02,340 --> 00:01:03,300
sort of command.
17
00:01:03,330 --> 00:01:05,280
We're expecting it to execute.
18
00:01:05,760 --> 00:01:07,470
And that's not what we want.
19
00:01:07,740 --> 00:01:14,730
All we want is to specify that this particular line is just the comment, just some sort of a note for
20
00:01:14,730 --> 00:01:17,730
us and not a strict command of the computer.
21
00:01:17,970 --> 00:01:23,310
So how can we do it if we would like to comment a single line in C programming language?
22
00:01:23,640 --> 00:01:27,240
Then we'll just use a double slash common prefix.
23
00:01:27,450 --> 00:01:27,860
All right.
24
00:01:27,900 --> 00:01:28,860
Something like that.
25
00:01:29,070 --> 00:01:36,480
This will indicate that these given line is not a command, but rather just common for us as the developers
26
00:01:36,720 --> 00:01:43,770
and guys please know that these comments section, these comments thing is basically used in all of
27
00:01:43,770 --> 00:01:45,200
the programming languages.
28
00:01:45,310 --> 00:01:48,240
They adsit just sort of a concept for developing.
29
00:01:48,690 --> 00:01:54,330
You may also use that in other programming languages that you may encounter in your future, such as
30
00:01:54,330 --> 00:01:57,900
Python, C++, Java and any other programming language.
31
00:01:58,140 --> 00:02:02,580
The only difference will be just in the way you specify the comment for each language.
32
00:02:02,880 --> 00:02:11,160
So, for example, here we use the double slash prefix to specifying the comment in C language and in
33
00:02:11,160 --> 00:02:12,000
other languages.
34
00:02:12,000 --> 00:02:18,210
You may use a double slash while in Python you may use hash, character and so on.
35
00:02:18,480 --> 00:02:19,260
All right.
36
00:02:19,290 --> 00:02:21,960
So we've seen how comments are used to comment out.
37
00:02:21,960 --> 00:02:28,530
Just single lines, buddy, for a comment happens to be more than just one line, which is definitely
38
00:02:28,530 --> 00:02:33,090
something that can happen than we would like to use something else.
39
00:02:33,210 --> 00:02:33,570
Right.
40
00:02:33,810 --> 00:02:40,080
And in such a case, we would like to use a slash asterisk to start a common block, which may consist
41
00:02:40,080 --> 00:02:42,210
of more than just one line of comments.
42
00:02:42,450 --> 00:02:48,340
And and these common blog, by using an associated asterisk slash that will indicate there.
43
00:02:48,510 --> 00:02:50,390
This is it for our common block.
44
00:02:50,610 --> 00:02:57,300
So as you can see here, you may insert a lot of comment lines as part of that common block, for example,
45
00:02:57,300 --> 00:02:59,970
specifying some status or whatsoever.
46
00:03:00,180 --> 00:03:04,120
In this example, we specify what the program does, that it's Prince.
47
00:03:04,500 --> 00:03:08,550
The full name and kind of calculate some average grade of a student.
48
00:03:08,760 --> 00:03:15,780
And then we also print they add the functionalities done and maybe some status above the date and some
49
00:03:15,780 --> 00:03:20,070
other information about what should be done in the future and so on.
50
00:03:20,310 --> 00:03:26,520
So basically, everything that may be necessary for us or for other a developer that will S.R.O. called
51
00:03:26,520 --> 00:03:27,300
in the future.
52
00:03:27,480 --> 00:03:34,790
So anything that was written after this slash asterisk and before the asterisk slash should be considered
53
00:03:34,800 --> 00:03:35,490
as a comment.
54
00:03:35,700 --> 00:03:40,620
So think about what you want to specify in your comments during different parts of your program.
55
00:03:41,040 --> 00:03:47,160
And make sure you use comments wisely, because they may save a lot of time and a lot of effort for
56
00:03:47,160 --> 00:03:48,180
you in the future.
57
00:03:48,360 --> 00:03:50,160
Thank you guys for watching this video.
58
00:03:50,190 --> 00:03:52,230
And I'll see you in the next one by.
5741
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.