All language subtitles for 2. Unions - Variables

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Now, let us talk about the need and also the use it for unions.

OK, so I think the best thing we can do right now is to start with a simple example.

Let us see some code snippet with the syntax regarding unions and then discuss what's going on behind

the scenes.

So first of all, how we define a union.

So how to define to define a union, how we basically will define it in our programming language.

So first of all, we are going to use the union key word.

So that's going to look like this.

So, Union, OK, this this is a saved key word that will specify that now we are at the process of

defining the union and then we will specify the union name.

OK, here will be the union name that we will choose.

Okay.

I'm just showing you now the template.

That's not an actual definition because we will have to replace here these union names with a real name.

Now what we are going to do is to specify inside of these union some data type one.

OK, so data type one and field one and then data type two and field two and so on and so forth.

So field two and so on.

OK, so that's basically the definition of a union.

OK, that's the template.

And if we want to take a look at some example of how basically a real union can be defined, so let

us use something like this.

OK, so union, that's the first key word union and then we'll specify its name, let's say invoke.

And I will also say what will be its fields.

OK, so let's create an array of characters.

So Charr first name with 20 characters and also let's create additional variable, let's call it, I

don't know, age.

OK, so we created a union called Info and it has two fields.

The first field is first name and that's an array of characters of size 20.

And also we have age, which is an integer.

All right, so what do you also can do, you can create any other union that you want to know, union

or I don't know, mean remarks.

OK, I don't know something like this, Reverend.

Whatever you decide.

And here he is.

Two variables.

Oops.

Sorry about that.

Ain't mean and ain't MOCs and I don't know, double average.

I don't know.

Whatever you want you can use is as part of the fields of this union.

And we will see the differences between these unions to structures because there is a difference, there

is a difference.

And that's what we are going to discuss right now because of the creation of the union is pretty similar

to how we used strong.

Right.

Because we simply used here like struct in marks and then we created some fields.

So union definition, the definition of a union is very, very straight, very, very similar to the

structure, but is actually quite what has quite differences behind the scenes.

But before we do so, OK, before we do so, this first of all, just remove this, I don't know, this

template, OK, or basically let's go and do it.

Let's make that comment.

So this will be a long comment, but will specify the template for creating a union.

At least it will be some union that we will use for these examples.

OK, so now before we will proceed and dive into what's happening behind the scenes, I will also use

some drawing, some visualization to make it more clear to you.

What I want us to do now is just to focus on basically how we can create a variable of these user defined

type of this union that we just created, this union info.

So if we want to create a variable of some user, a defined union type, then in this case it will look

like this.

OK, so let's write also down the template.

OK, so that's the template of running it.

So first of all, you specify union and the union name, union the name, and then you specify also

the variable name.

OK, so that's basically the main template for creating a variable, OK, creating a variable template

for creating a union variable.

OK, a union that has already been defined.

So in our case we will simply use something like this.

So you need lenfilm union info and let's say, I don't know my variable, let's go with my variable,

my variable one.

So this will create a new variable called my variable one.

And it's going to be of type what type?

Union info.

OK, nothing special.

And these type, you know how it looks like behind the scenes.

Basically, that's its definition and how it really represented in terms of like visually we are going

to see right away.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.