Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,470 --> 00:00:01,910
What is going on, guys?
2
00:00:01,940 --> 00:00:03,830
Welcome, ladies and gentlemen.
3
00:00:04,070 --> 00:00:11,300
And in this video, in this section, we are going to talk about a new topic in this new section that
4
00:00:11,300 --> 00:00:13,130
is called structures.
5
00:00:14,060 --> 00:00:22,640
So we are going to see basically to start with some general explanation explaining what are structures
6
00:00:22,640 --> 00:00:25,760
in general, why we should even consider using them.
7
00:00:26,180 --> 00:00:34,280
And then we will see a couple of examples that will show us how we can create a structure template,
8
00:00:34,280 --> 00:00:37,700
basically also understand what it is in the first place.
9
00:00:38,030 --> 00:00:44,210
Then we are going to see how can we create variables of the structure, how we can use them, how we
10
00:00:44,210 --> 00:00:49,130
can access different fields, which we will also study and so much more.
11
00:00:49,820 --> 00:00:51,270
So I hope you are ready.
12
00:00:51,290 --> 00:00:52,880
And let's go.
13
00:00:53,780 --> 00:01:02,840
So let us start, then talk about a common situation that I want you to suppose that you are writing
14
00:01:02,840 --> 00:01:11,450
some program am and this program has a main task to manage the employees in some company.
15
00:01:11,480 --> 00:01:13,940
OK, so a simple program to manage employees.
16
00:01:14,940 --> 00:01:23,250
And for every employee that you will have in your company, you have basically its name, the employee
17
00:01:23,280 --> 00:01:29,100
age, the salary and basically let's see also some seedy off leaving.
18
00:01:30,210 --> 00:01:35,820
And if this company we are talking about simply has just wanting blowy.
19
00:01:36,120 --> 00:01:41,490
Think of it as I don't know, just some start up on who with the one win company.
20
00:01:42,180 --> 00:01:49,440
Then in this case, it would be really simple because we could simply create just four variables describing
21
00:01:49,440 --> 00:01:54,310
these information regarding this one and only employee.
22
00:01:54,330 --> 00:01:54,720
Right?
23
00:01:55,290 --> 00:02:03,420
So we would have like variables such as a string variable that represents the name of the employee.
24
00:02:03,990 --> 00:02:09,600
We would also have like an integer variable that will represent the age.
25
00:02:10,170 --> 00:02:17,330
We also may have some float variable that will be used to represent, for example, the salary.
26
00:02:17,340 --> 00:02:25,020
And finally, I don't know, another string to represent the city where the employee resides.
27
00:02:25,360 --> 00:02:26,740
OK, so far, so good.
28
00:02:26,760 --> 00:02:28,230
Nothing complicated, right?
29
00:02:29,160 --> 00:02:36,450
Simply having four variables representing information about the one employee of this company.
30
00:02:37,170 --> 00:02:41,070
But in here comes the important thing.
31
00:02:41,520 --> 00:02:43,770
What will happen if this company?
32
00:02:43,770 --> 00:02:45,480
I want you to think about it.
33
00:02:45,720 --> 00:02:50,040
What will happen if this company will hire another employee?
34
00:02:50,880 --> 00:02:54,540
So what will be there like two employees?
35
00:02:55,290 --> 00:03:02,700
So in this case, probably, probably you would have to use like two strings variables to represent
36
00:03:02,700 --> 00:03:04,950
the names of these two employees.
37
00:03:05,310 --> 00:03:07,270
And let's say it will be like name.
38
00:03:07,290 --> 00:03:12,570
Name one for employee number one and two for employee number two.
39
00:03:13,140 --> 00:03:19,950
And then you will have like age one do or salary one salary two and city one in city two, right?
40
00:03:20,340 --> 00:03:27,870
So to summarize, we can say that for two employees, our program will already have like these eight
41
00:03:27,870 --> 00:03:33,510
variables associated with these workers in our company, right?
42
00:03:34,410 --> 00:03:44,100
And what would happen if we if the company will hire like about 10 employees or maybe thousand employees,
43
00:03:44,610 --> 00:03:46,660
which could easily be in this case, right?
44
00:03:46,680 --> 00:03:54,570
Because we know that there are a lot of companies with this many employees and even more in this case,
45
00:03:54,780 --> 00:04:03,890
should we have like 4000 variables, for example, distributed in a sort of really unorganized manner?
46
00:04:03,960 --> 00:04:04,510
OK.
47
00:04:04,620 --> 00:04:08,910
Like age one, age to age three up until age 2000.
48
00:04:10,110 --> 00:04:11,250
Probably not.
49
00:04:11,370 --> 00:04:19,230
Of course, we don't want to have in our record in our program, these kind of variables are scattered
50
00:04:19,240 --> 00:04:22,170
around, not organized in any way.
51
00:04:22,560 --> 00:04:27,090
Know it's really difficult to to manage it this way, in my opinion, at least.
52
00:04:28,320 --> 00:04:35,220
So what I suggest is a method to organize our program in a better manner.
53
00:04:36,060 --> 00:04:41,310
And one way to do so is by using what do you think, structures?
54
00:04:42,210 --> 00:04:49,830
So we will be using structures that will give us the option to gather every detail and every irrelevant
55
00:04:49,830 --> 00:04:59,010
information regarding every individual employee simply rearranging it, organizing under one roof,
56
00:04:59,160 --> 00:05:01,290
under one structure.
57
00:05:01,890 --> 00:05:03,120
Is that clear so far?
58
00:05:03,480 --> 00:05:04,350
Nothing complicated.
59
00:05:04,650 --> 00:05:07,470
Just the general explanation of organizing.
60
00:05:08,370 --> 00:05:16,530
Let's see every detail about an employee, which was the name the salary, the city where the employer
61
00:05:16,710 --> 00:05:18,330
resides and its age.
62
00:05:19,260 --> 00:05:20,970
All of these four fields.
63
00:05:20,970 --> 00:05:25,560
Let's go this way simply to organize it under one roof.
64
00:05:26,070 --> 00:05:26,580
OK.
65
00:05:26,940 --> 00:05:29,940
And this roof will be the struct that we will learn.
66
00:05:29,940 --> 00:05:32,010
But so far, so good.
67
00:05:33,210 --> 00:05:42,150
And now let's explain how all of this mechanism of simply what I just said, how all of this mechanism
68
00:05:42,330 --> 00:05:44,010
works behind the scenes.
69
00:05:44,370 --> 00:05:48,930
And let's take a look at how this structure concept comes in.
70
00:05:49,620 --> 00:05:59,160
Also, in general and in the next videos in particular to our programming language and also like diving
71
00:05:59,310 --> 00:06:00,510
in more details.
72
00:06:00,870 --> 00:06:01,350
All right.
73
00:06:02,280 --> 00:06:08,040
So let's simply think of some standard variables that we've worked with.
74
00:06:08,250 --> 00:06:08,700
OK.
75
00:06:08,820 --> 00:06:10,950
I'm just going to show you a quick example.
76
00:06:11,400 --> 00:06:17,550
So let's say when we wrote some lines like this, let's say age equals 250.
77
00:06:18,210 --> 00:06:22,280
And we had some other variable that is called like salaries.
78
00:06:22,280 --> 00:06:28,630
So float salary that is used basically to represent, you know, the salary per hour.
79
00:06:28,650 --> 00:06:32,310
Let's go and initialize it with some random value.
80
00:06:33,480 --> 00:06:39,300
And now that's basically where things get interesting, OK?
81
00:06:39,330 --> 00:06:43,940
We have like these two standard boxes age and salary.
82
00:06:43,950 --> 00:06:47,910
One of them is of type, end and the other of type float.
83
00:06:48,300 --> 00:06:48,720
OK.
84
00:06:48,960 --> 00:06:51,570
So both both of them are variables.
85
00:06:51,570 --> 00:06:54,150
Different types are different values and so on.
86
00:06:55,020 --> 00:06:57,870
And now we are going to take these two boxes.
87
00:06:57,930 --> 00:06:58,320
OK.
88
00:06:58,350 --> 00:07:00,480
These are actual boxes that we have.
89
00:07:01,540 --> 00:07:08,530
And we are going to pack them together into a new type of a box.
90
00:07:08,770 --> 00:07:16,510
So taking these two boxes age and salary and packing them up under one roof, under one structure.
91
00:07:16,870 --> 00:07:20,340
And they will be represented under one box.
92
00:07:20,350 --> 00:07:20,740
OK?
93
00:07:21,760 --> 00:07:23,410
So we are.
94
00:07:24,300 --> 00:07:26,490
We don't have any problem here.
95
00:07:26,520 --> 00:07:27,870
We could do so right.
96
00:07:28,020 --> 00:07:32,760
I mean, why not sort of just boxes and so on and.
97
00:07:33,870 --> 00:07:35,580
Now, what I want to say is that.
98
00:07:37,870 --> 00:07:45,610
In this case, the boxes within the bigger box, OK, we'll have like a bigger box inside of these bigger
99
00:07:45,610 --> 00:07:45,880
box.
100
00:07:45,880 --> 00:07:50,440
We will have like a smaller box of end in a smaller box of float.
101
00:07:50,500 --> 00:07:59,140
OK, so simply two boxes inside just one newly created box that we created.
102
00:07:59,170 --> 00:08:06,640
OK, we need not define yet its type, but I just want you to visualize it before we go any further.
103
00:08:06,730 --> 00:08:07,150
OK.
104
00:08:08,230 --> 00:08:16,210
So if we already started talking about its type, what do you think should be the type of this newly
105
00:08:16,210 --> 00:08:17,320
created box?
106
00:08:18,130 --> 00:08:21,640
Should it be treated as an integer type of flow type?
107
00:08:22,300 --> 00:08:30,430
We can simply say that our box will be of an integer type rate if you build a house, also the end and
108
00:08:30,430 --> 00:08:30,970
the float.
109
00:08:31,390 --> 00:08:33,430
It simply doesn't make any sense.
110
00:08:34,120 --> 00:08:40,690
But what we can do and what we should do, and probably in the next videos, that's what we are going
111
00:08:40,690 --> 00:08:41,140
to do.
112
00:08:41,980 --> 00:08:43,930
We are going to refer to.
113
00:08:43,930 --> 00:08:49,870
The new box is a new defined type that we are going to create.
114
00:08:50,350 --> 00:08:50,630
OK.
115
00:08:50,650 --> 00:08:51,490
We are going to.
116
00:08:52,710 --> 00:08:57,040
Pacify, what will be this new type?
117
00:08:57,060 --> 00:09:06,870
OK, so we will simply have a new type, some new representation that will be able to create variables
118
00:09:06,870 --> 00:09:07,170
for me.
119
00:09:07,260 --> 00:09:15,450
OK, so we will define this template to define the structure of this new box that it will have like
120
00:09:15,540 --> 00:09:19,470
first variable and integer second variable float.
121
00:09:19,800 --> 00:09:21,420
Maybe other variables, right?
122
00:09:21,600 --> 00:09:29,880
So we will define its template and then we will use this template for the creation of these new unique
123
00:09:29,880 --> 00:09:34,080
type boxes for basically our usage.
124
00:09:35,010 --> 00:09:43,530
So I hope this quick and hopefully general explanation is clearer to you if you still have any questions.
125
00:09:43,650 --> 00:09:47,460
I recommend going on for the next videos.
126
00:09:48,000 --> 00:09:52,680
There are a lot of things to cover us for in this section.
127
00:09:53,250 --> 00:10:02,400
And just a quick reminder you are doing great so far, but I really, really think that your concentration
128
00:10:02,400 --> 00:10:06,310
on this section is absolutely necessary, OK?
129
00:10:06,980 --> 00:10:11,040
That's not going to be an easy one, but I think we can handle it.
130
00:10:11,460 --> 00:10:13,120
Don't you think so?
131
00:10:13,140 --> 00:10:18,210
I wish you good luck on this section, and I will see you on the next video.
132
00:10:18,270 --> 00:10:19,860
Give it some time.
133
00:10:20,430 --> 00:10:27,150
Think about basically everything that will be said on the next videos like write notes down.
134
00:10:27,510 --> 00:10:29,610
Think about what is the explanation.
135
00:10:29,610 --> 00:10:37,590
Some of the explanation are going to be a little bit slower since in my experience, I know that most
136
00:10:37,590 --> 00:10:41,950
of the students need some parts to be explained a little bit slower.
137
00:10:42,000 --> 00:10:45,050
Some parts to be a little bit faster.
138
00:10:45,060 --> 00:10:47,880
So I hope you will like it.
139
00:10:48,060 --> 00:10:56,520
If the temp will feel to you a little bit slower than what you expected, you can simply make the speed
140
00:10:56,520 --> 00:10:58,260
of the video a little bit faster.
141
00:10:58,860 --> 00:11:00,480
So thank you guys for watching.
142
00:11:00,510 --> 00:11:04,260
Keep on practicing and I see you in the next videos.
143
00:11:04,590 --> 00:11:05,020
Bye bye.
13356
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.