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
OK, so now what we are going to do is to talk about how we can declare a variable of some structural
type we've that we've just defined in one of our previous videos.
OK, so if you want some strict, easy way to understand the rules and how you can create a variable
of a defined structure template, here it is.
So first of all, you use this struct, OK, you first use the word struct, then you specify the template,
OK, the template structure name that you want to use, just like we've created previously structured
template point's structure, template daid and structure template address, for example.
So for example, if we have let's wait a minute where it is here.
Not a pen but a laser pointer.
So basically if previously we had created our data structure and we want to create a data structure
variable to declare it, what we are going to use is simply struct.
OK, just like the formula written here.
OK, so that this will be our that will be our formula.
OK, on how to declare a variable struct and then what we are going to have is struct struct is OK,
the structure name that we've just created in the previous video.
OK, it was just something like struct Dade Curly brackets and it was in today int month and into year.
OK, if you do not remember exactly what it was, you may go to the previous video and to make sure
of that.
And basically there you go.
You have created two variables of struct date type, each of them.
OK, we will take a look.
Let's say just that my date one.
OK, so that's the variable.
And each of these variables contain is part of them are some integers, OK, which are just these smaller
boxes representing the day, the month in the year.
Awesome.
So here you go.
The variable name like this one.
OK, so that's the variable we created in this variable is of type struct date.
And we know that strike date is a template for structure with three fields.
The first one is day, the second is month and the third is year.
Amazing.
So what we created is a new variable called My Date one with three fields.
Just make sure that you notice that all of them are not yet initialized.
OK, so we don't know what will be their values, just like you created in day, in month and in year.
You don't know they are values that they are not yet have been initialized.
All right.
And now what I want to show you guys is how we can access to variables fields.
So, for example, we created some variable of some new type.
OK, where did it go?
So we created this variable, my each one with these three fields.
And let's think of these might add one is a variable in new box, bigger box that contains three smaller
box, smaller boxes as part of a date, day, month and year.
So we have these inner boxes that we said that they are if we talk officially, these are just the fields
of this structure.
So these variables, which are part of the bigger box, can be thought of smaller boxes.
OK, I'm just saying it once again.
Think of this simple analogy and your life will be much easier just in the terms of programming again
and in this course.
But you understand these concept of boxes.
Trust me, guys, I I've taught a lot of students how to code and this analogy really works.
So if you let's go back to our EXIS if you want to access one of these fields, OK, we know that currently
they are not initialized one of these inner boxes.
If you want to access them, then it can be done just by using the dot notation.
So first of all, you specify the variable name.
You know that the variable name is not date, OK, it's not strike date.
Let's just refer it to destruct template.
We know that the variable name in this case is my date one.
So we specify my date.
One thought, OK, you put this point and you specify the field name and you know that by looking if
you're going to look at the structure template, you can see there every time you are going to use my.
You always can see any of the exact fields that a given structure has, so you know that this structure
might each one is of a date structure type and date structure type consists of three fields, day,
month and year.
So we are going to specify this field, whatever we want to access.
For example, if we want to access the day, we can specify it here, the month, the year and so on.
So finally, let's make this example.
So might each one variable name dot de the name of the field equals to ten.
We are basically going to this variable to the field of date and put value of ten inside.
So my date one that month month equals to three.
You're going to do the same.
Might each one dot year you you're going to put here the value of fear.
That's basically how it works, that that's basically how you access any of the fields of a given variable
of some structure template.
And we know that if we can read and access some values, OK, from a given place, we can basically
use also the print command to print the values to the screen.
OK, so for example, if you want to print these values through the screen, you may use like something
like that.
Let's just put it here where it is.
Come here.
OK, so you may go like print F, OK, so print F specify here.
I don't know, percentage D, OK.
And instead of that percentage then you may specify this value.
OK, for example, if you want to print the day.
So you specify my date one dot date here and it will be replaced in with this placeholder of percentage.
So that's how you, how you print the value since you know how to access it.
And also since you know how to access a given, let's say, sale inside of this in a given field inside
of this variable, you can also use a scanner function to read values from the user.
And what you are going simply to do if you want to like to read the given a value from the user and
to place it inside of this field of the day field.
So you specify second half percentage there and just use an ampersand here before the value you want
to access to to feel it.
So my suggestion to you guys is make sure that you understand everything that we spoke about in this
video and also make sure you open up your I.D. and give it a little bit of practice and run a couple
of commands and make sure that you can see everything is it should be so until next time.
Keep on practicing.
Keep on moving forward.
And guys, you are bound to succeed him and wish you a good day.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.