Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
What is going on, guys?
Welcome, ladies and gentlemen.
And in this video, in this section, we are going to talk about a new topic in this new section that
is called structures.
So we are going to see basically to start with some general explanation explaining what are structures
in general, why we should even consider using them.
And then we will see a couple of examples that will show us how we can create a structure template,
basically also understand what it is in the first place.
Then we are going to see how can we create variables of the structure, how we can use them, how we
can access different fields, which we will also study and so much more.
So I hope you are ready.
And let's go.
So let us start, then talk about a common situation that I want you to suppose that you are writing
some program am and this program has a main task to manage the employees in some company.
OK, so a simple program to manage employees.
And for every employee that you will have in your company, you have basically its name, the employee
age, the salary and basically let's see also some seedy off leaving.
And if this company we are talking about simply has just wanting blowy.
Think of it as I don't know, just some start up on who with the one win company.
Then in this case, it would be really simple because we could simply create just four variables describing
these information regarding this one and only employee.
Right?
So we would have like variables such as a string variable that represents the name of the employee.
We would also have like an integer variable that will represent the age.
We also may have some float variable that will be used to represent, for example, the salary.
And finally, I don't know, another string to represent the city where the employee resides.
OK, so far, so good.
Nothing complicated, right?
Simply having four variables representing information about the one employee of this company.
But in here comes the important thing.
What will happen if this company?
I want you to think about it.
What will happen if this company will hire another employee?
So what will be there like two employees?
So in this case, probably, probably you would have to use like two strings variables to represent
the names of these two employees.
And let's say it will be like name.
Name one for employee number one and two for employee number two.
And then you will have like age one do or salary one salary two and city one in city two, right?
So to summarize, we can say that for two employees, our program will already have like these eight
variables associated with these workers in our company, right?
And what would happen if we if the company will hire like about 10 employees or maybe thousand employees,
which could easily be in this case, right?
Because we know that there are a lot of companies with this many employees and even more in this case,
should we have like 4000 variables, for example, distributed in a sort of really unorganized manner?
OK.
Like age one, age to age three up until age 2000.
Probably not.
Of course, we don't want to have in our record in our program, these kind of variables are scattered
around, not organized in any way.
Know it's really difficult to to manage it this way, in my opinion, at least.
So what I suggest is a method to organize our program in a better manner.
And one way to do so is by using what do you think, structures?
So we will be using structures that will give us the option to gather every detail and every irrelevant
information regarding every individual employee simply rearranging it, organizing under one roof,
under one structure.
Is that clear so far?
Nothing complicated.
Just the general explanation of organizing.
Let's see every detail about an employee, which was the name the salary, the city where the employer
resides and its age.
All of these four fields.
Let's go this way simply to organize it under one roof.
OK.
And this roof will be the struct that we will learn.
But so far, so good.
And now let's explain how all of this mechanism of simply what I just said, how all of this mechanism
works behind the scenes.
And let's take a look at how this structure concept comes in.
Also, in general and in the next videos in particular to our programming language and also like diving
in more details.
All right.
So let's simply think of some standard variables that we've worked with.
OK.
I'm just going to show you a quick example.
So let's say when we wrote some lines like this, let's say age equals 250.
And we had some other variable that is called like salaries.
So float salary that is used basically to represent, you know, the salary per hour.
Let's go and initialize it with some random value.
And now that's basically where things get interesting, OK?
We have like these two standard boxes age and salary.
One of them is of type, end and the other of type float.
OK.
So both both of them are variables.
Different types are different values and so on.
And now we are going to take these two boxes.
OK.
These are actual boxes that we have.
And we are going to pack them together into a new type of a box.
So taking these two boxes age and salary and packing them up under one roof, under one structure.
And they will be represented under one box.
OK?
So we are.
We don't have any problem here.
We could do so right.
I mean, why not sort of just boxes and so on and.
Now, what I want to say is that.
In this case, the boxes within the bigger box, OK, we'll have like a bigger box inside of these bigger
box.
We will have like a smaller box of end in a smaller box of float.
OK, so simply two boxes inside just one newly created box that we created.
OK, we need not define yet its type, but I just want you to visualize it before we go any further.
OK.
So if we already started talking about its type, what do you think should be the type of this newly
created box?
Should it be treated as an integer type of flow type?
We can simply say that our box will be of an integer type rate if you build a house, also the end and
the float.
It simply doesn't make any sense.
But what we can do and what we should do, and probably in the next videos, that's what we are going
to do.
We are going to refer to.
The new box is a new defined type that we are going to create.
OK.
We are going to.
Pacify, what will be this new type?
OK, so we will simply have a new type, some new representation that will be able to create variables
for me.
OK, so we will define this template to define the structure of this new box that it will have like
first variable and integer second variable float.
Maybe other variables, right?
So we will define its template and then we will use this template for the creation of these new unique
type boxes for basically our usage.
So I hope this quick and hopefully general explanation is clearer to you if you still have any questions.
I recommend going on for the next videos.
There are a lot of things to cover us for in this section.
And just a quick reminder you are doing great so far, but I really, really think that your concentration
on this section is absolutely necessary, OK?
That's not going to be an easy one, but I think we can handle it.
Don't you think so?
I wish you good luck on this section, and I will see you on the next video.
Give it some time.
Think about basically everything that will be said on the next videos like write notes down.
Think about what is the explanation.
Some of the explanation are going to be a little bit slower since in my experience, I know that most
of the students need some parts to be explained a little bit slower.
Some parts to be a little bit faster.
So I hope you will like it.
If the temp will feel to you a little bit slower than what you expected, you can simply make the speed
of the video a little bit faster.
So thank you guys for watching.
Keep on practicing and I see you in the next videos.
Bye bye.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.