All language subtitles for 2. Syntax of constants and its usage

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

All righty, so in this video, what I would like us to do is simply to understand how we should create

a constant in our C programming language now that we've been introduced with what basically the general

idea behind concept.

And now let us talk how they can be used in C.

So there are a couple of definitions that you can use, but the default definition is simply by adding

the word const before the variable declaration.

So, for example, if we know that our year of birth should remain the same during the execution of

the program, then it makes sense to create some variable and to define it as const right.

Because we don't want this variable, this value that we will give to change over time.

Right.

Because the year of birth probably he doesn't make any sense that it will get changed.

So in this case, what you would like to do is simply do the following.

OK, so we use const int year equals to do thousand.

So very, very simple to the way we created our standard variable.

Just just like you, you've created your standard variable, just that.

Now you simply add the keyword const before.

OK, so const integer equals to two thousand.

It doesn't have to be of an integer type.

OK, these kind of values may also a constant valued may also be of a floating point.

I for example like this const float salary equals to thirty one point thirty five.

OK, that's also OK and basically very similar to how you create a variable.

OK, we are talking now about the syntax of constants and see how we create these constants.

So simply adding the cons, the word before and now any attempt that may be used to change this value

will result in a compilation error.

So basically, that's kind of OK, because these compilation error is kind of nice, because if you

will attempt to change its value, it will not be like a problem during the execution.

You will get notified at the compilation step.

OK, so if you will attempt to I don't know if you have, like, I don't know, on a constant salary

per hour, it does not suppose to get changed.

Is also your year of birth.

It's not supposed to get changed during the execution of your program.

So if you simply would have tried to change this value during ah during some, I don't know, function

or whatever calculation you've made by mistake.

Right.

You even you didn't even notice.

So then the compiler will tell you, hey guy, listen, there is a problem, please check it out once

again, the constant value that you are trying to change.

So basically that's how it works.

All right.

So to summarize, you get only one chance to set its value of a constant at the initialization phase

in this case, after words you are not allowed to modify during the execution of your program.

And I hope that's clear because it's not so difficult topic in my opinion.

But some people find it like hard to grasp, especially with information I'm going to share with you

on my next video.

So stay tuned and we will cover everything up really quickly.

So, yeah, I think we are ready to move on.

Thank you for watching.

My name is what we sell for Tech and we are moving forward.

Let me know, of course, if you have any questions and do them by my.

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