All language subtitles for 6. Challenge 2 - Guess what would be printed

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

What is going on, guys?

And welcome back to another challenge in our AC programming course.

And in this challenge, it's kind of a unique challenge.

We are going to do something new.

We are going to get this piece of code.

And your task is without using the computer, just with a pen and a piece of paper, let's say your

task is to think of what and what would and what should be printed in each of these printer lines.

So we have here a couple of print of lines.

So you can see it right here.

One, two, three, four, five, six, six printer lines that print the values of two two variables.

Number one, number two.

And also the Pointer SPDR and BTR be in your task is to find out and write down on a piece of paper.

What would be printed to the screen just based on your look of this code?

This will help us understand where we stand with the material and make sure that we understand all the

principles we've learned so far.

So give it a try.

Pause the video and resume in three, two, one.

OK, so now you should be after you've written down all the answers on a piece of paper and you are

ready to move on and to make sure that your results are actually good.

So one of the ways to start this exercise, let's just I think let's go briefly to on what happens happening

here.

So we create we initially two variables.

Number one and number two.

And then one will be five.

Number two will be seven.

Just simple standard variables of an integer type.

And then we create two pointer variables.

Pointer is to end.

And these two boxes, BTR, Way and Yerby.

Currently they do not point anywhere.

Right.

They are on initialised.

So these printer line is very simple.

We print the value of number one and number two, and that's it.

This will be our number one equals two five.

And number two equals two seven.

And now what we are doing is simply to point.

OK.

So we take the address of number one and put it inside of the BTR, a variable.

So BTR A will now hold of the address of.

Now one, the address of where number one resides.

And we are doing also the same for BTR, Yerby and number two.

So BTR and BTR.

B, basically if we would have watched from from outside BTR and BTR B point to these two variables,

they hold these two variables BTR and BTR.

B hold the address of number one and number two.

So that's very important to understand that these two variables hold addresses.

They point to number one and number two, and you can access and change and do whatever you like to

number one and two through the SPDR Array and Peter Yerby.

So now here are the second print off-line.

We see that we print exactly the same.

And we know that PDR eight points to this variable and BTR B to the second one.

And that basically doesn't change anything.

Even if someone is pointing at another variable, that shouldn't change anything.

So the result will be five and seven once again.

And now what we are doing is kind of interesting.

We know that if BTR a codes are the address of number one.

And if you specify a pointer before you just saying that, go to the address that BTR a points to go,

go there, go to number one.

So it's simply almost the same as we would have written.

Now one equals two.

This one.

So pointer BTR A will be equal to points or BTR A plus one.

So this is equivalent to number one.

You just access the other variable, number one, adjusting directly.

So previously no one was five.

So five plus one is six.

And you just change the value inside of NUM one.

So we know that right now.

Now one behind the scenes equals the six.

And also the same we do for NUM two.

So BTR Appointer, BTR B equals 2.0, BTR B which is now two plus three and NUM two was seven.

So we are going to get num two equals to ten.

And now what we are going to print is the values of NUM one and number two and make sure that you really

were were able to change the values of NUM one and two through.

These are pointers.

And the result is going to be six and 10.

So have you done everything correctly so far?

Please let me know if.

Phew.

I struggle with this topic.

And if you got any stakes here, because I think that that only these two lines are new so far to what

we've done here.

And I think they're pretty much OK because we understand that we can access any of the elements that

we point to and modify them in directly.

And now what we are doing in lines 21, 22, we simply take BTR three, which holds the address of number

one, and BTR beholds jetways of None two.

And we say that BTR A will now hold the address are specified in BTR B, which is the address of Nahm

two.

So basically what's what's happening behind the scenes is that now BTR, a will point will point to

number two.

OK, as well as also BTR, BTR B at this point also points to number two.

So both of them, BTR and BTR, b, both of them point to the same variable NUM two.

And when we say right now BTR B equals two.

BTR A, what is going to happen is that we are not going to change anything.

BTR B is going to point where BTR eight points to an BTR, eight points to NUM two.

Right.

We see that it happens before.

So nothing changes.

Still remain the same.

Both of them point to number two and none of them points to num one.

So if we try to bring the result on the screen, we can see that it still remains six and ten because

we did not change any of the values of NUM one and two we just modified.

Who is pointing to we're just modifying the pointer variables.

And if we are going to print the result here.

OK.

So pointer BTR a and point there.

BTR B we know that we access to the address of the variable that we point to and we know that both of

them point to number two.

So the result is going to be ten and ten.

So that's very important.

Guys, this line twenty five is very important to understand.

So is there a last example?

Our last printf line, we are going to use this sign meant to assign some new value that is stored inside

of the variable that BTR B points to.

And this variable, we said is simply write.

It was what it was to.

Right.

So num two.

So we know is that very instead of these pointer B, we are getting the value inside of NUM two, which

is currently just ten.

So at this point no one will be equal to ten.

And of course we can calculate num to name two will be equal to 10 minus three, which is a total of

seven.

And we can say that in the last print off-line we are going to print ten.

OK.

We're going to print num one equals two.

So of one equals two ten and num two equals equals num two equals two seven.

So that's basically it for these exercise guys.

And we practice how pointers work, what they store inside of them.

How do they point to another variable.

And in this example, this variable was of an integer type.

Of course it will be very similar if we would have used here a floating point.

So it may be a free float, floating point type.

And then, of course, we would expect that these variable BTR A, which is a pointer to a float, will

not point to number one when number one is just an integer.

So we expected that it will point to a very variable of a floating point type.

Is the same you can do just with charts and so on and so forth.

So thank you so much for watching.

Give it a try.

And when you're on your own, make sure that all the printed results that we've discussed right now

are exactly as you got them on your piece and paper.

And until the next video, I'll see you there.

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