All language subtitles for 20. Reset All Elements of An Array to 0

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,330 --> 00:00:06,900 So now we are going to write a function that will reset all the elements, all the elements of an array 2 00:00:07,080 --> 00:00:15,870 to zero, reset all the elements of an array to zero warm, maybe to set it all to set all the elements 3 00:00:15,870 --> 00:00:18,220 to be equal to some other value. 4 00:00:18,300 --> 00:00:23,790 So if that's the case, we can see that a function simply does not return anything. 5 00:00:23,800 --> 00:00:27,090 So it's probably going to be of a void type. 6 00:00:27,100 --> 00:00:33,120 So void and let's call it reset aliments or reset. 7 00:00:33,660 --> 00:00:38,370 Yeah, reset elements to zero, for our example. 8 00:00:38,460 --> 00:00:41,010 And this function is very similar to the previous one. 9 00:00:41,010 --> 00:00:43,140 We just get a pointer. 10 00:00:43,200 --> 00:00:47,070 OK, that will hold the address of the first element here. 11 00:00:47,070 --> 00:00:49,560 We have our array, the first element. 12 00:00:49,830 --> 00:00:54,450 So it's going to be named Star BTR and also the size. 13 00:00:54,660 --> 00:01:01,710 It's very similar to the previous exercise we are going to create now a temporary variable called AI 14 00:01:01,920 --> 00:01:06,840 that will help us for iterating over these these arrays. 15 00:01:06,840 --> 00:01:10,410 So equals to zero as long as I listened in size. 16 00:01:10,650 --> 00:01:15,900 And we know for sure that we are passing over all of our array. 17 00:01:16,080 --> 00:01:18,810 And what we are going to do is very simple. 18 00:01:18,820 --> 00:01:27,570 We are going to specify BTR and Index I BTR, specify the address, the address of first element here, 19 00:01:28,110 --> 00:01:31,460 and it's pretty much like working with ARAA right now. 20 00:01:31,500 --> 00:01:39,300 So BTR and, you know, the first address and axis of the element that inside of these square brackets 21 00:01:39,510 --> 00:01:40,980 specifying the index. 22 00:01:40,980 --> 00:01:48,810 So you really access the previous, the real one and the real array and you just modify its values. 23 00:01:48,810 --> 00:01:55,970 So meteoritic bekesi equal to zero and that's what you do for all of your array elements. 24 00:01:56,310 --> 00:02:01,230 And once these function is done, you simply you are not expected to return anything. 25 00:02:01,230 --> 00:02:04,320 Right, because this function is of a void type. 26 00:02:04,320 --> 00:02:07,710 So you simply call it reset elements to zero and there you go. 27 00:02:07,890 --> 00:02:13,790 You should expect that your array will that all the elements will be equal to zero. 28 00:02:14,130 --> 00:02:20,820 So just to make sure you can write here, reset, reset elements to zero, you give it the array and 29 00:02:20,820 --> 00:02:22,440 you also give it a size of three. 30 00:02:22,730 --> 00:02:23,490 There you go. 31 00:02:23,670 --> 00:02:27,090 All the elements of these lines should be equal to zero. 32 00:02:27,210 --> 00:02:33,900 But one way to make sure of it is to write another function that simply gets an array and prints it. 33 00:02:33,930 --> 00:02:40,560 OK, so this was our first function and we are also going to write in this exercise additional function 34 00:02:40,920 --> 00:02:47,540 that is also going to be of every type and it's going to receive, let's call it print error. 35 00:02:47,790 --> 00:02:54,240 It's going to receive it's going to receive a pointer just like previously and this size. 36 00:02:55,020 --> 00:03:00,230 And all he's going to do is to print all the information for this array. 37 00:03:00,240 --> 00:03:03,690 So I'm just I just can't copy this here. 38 00:03:03,720 --> 00:03:09,230 And I fawry equals to zero as long as it's than size C++. 39 00:03:09,240 --> 00:03:14,570 And what we have to do now is simply instead of using it like this, we're going to just print out, 40 00:03:14,910 --> 00:03:23,700 I'm going to remove that print F and print the value, let's say percentage here, write each percentage 41 00:03:24,570 --> 00:03:26,760 and PVR IT index. 42 00:03:26,850 --> 00:03:32,820 I'm not using a backslash and here because I want all of them to be printed in just one line. 43 00:03:33,480 --> 00:03:35,600 So let's just go like this. 44 00:03:35,610 --> 00:03:36,570 And there you go. 45 00:03:36,570 --> 00:03:40,800 You have the function that prints every array that you are going to send it. 46 00:03:40,810 --> 00:03:43,140 And now what we are going to do is to test it out. 47 00:03:43,300 --> 00:03:50,850 OK, so here we have INTERFERER, so let's call the function printer before it was modified, OK, before 48 00:03:51,030 --> 00:03:59,430 I'm just used here or some little message that we'll print before resetting, before we said OK, so 49 00:03:59,430 --> 00:04:08,070 before we said the array is going to be specified here and print are always going to print all the elements. 50 00:04:08,070 --> 00:04:12,270 And now we are also going to add here pretty much the same. 51 00:04:12,270 --> 00:04:18,550 So print, print after preset and print are OK. 52 00:04:18,600 --> 00:04:21,270 So basically you've got the idea we are going to print. 53 00:04:21,420 --> 00:04:26,150 Before that we said all the array and after that we said so let's just build and run it. 54 00:04:26,220 --> 00:04:28,540 Click here on this button. 55 00:04:28,890 --> 00:04:30,090 So there you go. 56 00:04:30,680 --> 00:04:34,380 Just one mistake that I forgot to add, a backslash, zero backslash. 57 00:04:34,380 --> 00:04:41,310 And so before we said one, three, ten and after that we said zero zero zero, you can see that all 58 00:04:41,310 --> 00:04:42,570 are nullified. 59 00:04:42,580 --> 00:04:45,630 So just in the printer you are at a baseline. 60 00:04:45,930 --> 00:04:50,430 So once you're done printing an array, you will go to the next line. 61 00:04:50,430 --> 00:04:52,320 So let's see how it looks right now. 62 00:04:52,470 --> 00:04:58,560 So before the reset, after that, we said and basically it works like a charm. 63 00:04:58,710 --> 00:04:59,820 So thank you guys for. 64 00:04:59,900 --> 00:05:07,720 Watching this was a good video we showed here to functions, research elements to zero and print error. 65 00:05:07,730 --> 00:05:11,330 So keep on practicing and I'll see you in the next video. 6665

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