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
So let's understand how we can copy an array.
So, first of all, we said that we need to initialize it with some values in the array is going to
be of a size three, OK, because we represent a date and we know that it eight consists of day, month
and year.
So that's why we are going to use the size of three.
And now what I want us to do is to initialize this array.
So let's say we are going to call this array are indeed.
OK, so in date will create, let's say, of cise right this size.
So this way we declare an array of size three in this case sizes three.
The name of this area is going to be date.
And at every sale, at every element of this array, we will have an integer value.
But we said that we don't want just to declare it.
We said that we want to initialize it with some arbitrary value.
So let's say one is the date is the day, two is the month and two thousand is the year.
OK, so we initialized our array and now what do we want to do is to create additional arrays.
So let's say into today two of the same size.
We just created not two, not only initializing it, just creating it.
And we want to copy we want to copy this array, the original array do these particular array, which
is on initialized in this step.
So what will be the most intuitive way to do so?
So we are probably right, because the most easiest way that would come to mind is simply to use the
assignment operation and just say day two equals today and that's it.
You're done.
And you expect that this array will just be copied into these data.
But that's not the case.
It won't work in our programming language.
So for for copying an array, for copying one array into another, we are going to use some for a loop
to basically these for a loop will allow us to run over each of these elements and to copy them one
by one into these secondary our target array.
So for that, we need to create additional variable int I that will help us in using the for loop and
now we are going to use for equals to zero as long as I list this size I plus plus and now in the loop
buddy, we are going to copy the elements one by one.
So previously we have declared this array.
So behind the scenes.
OK, so we has three elements and there is some garbage values let's say are stored inside here.
And we are going to iterate over this array.
And first of all, IT index equals to zero, which will give us the value of one we are going to copy.
So just use data and the indexing will be equals to date at the index.
So copying element by element one after another.
That's how you copy an array in C programming language.
Now once you've copied, let's try to print the content of each of these arrays so it equals zero eyes
list then size II plus plus.
OK, so now we are going to print the values to print the elements inside of these of any of these arrays.
So print f let's do it like this or print f r r let's see date original date original or Reiji original
date and index the original date m original date.
They know how we should do it, how we should do it.
We should simply use some index.
So let's say we are using original date at index, let's say percentage equals two percentage D and
and here we are also going to use additional print earth line.
So will we will see the target.
OK, or that copied, copied, copied date at index percentages equals the percentage.
And here instead of these percentages of the first one, we are going to specify are I right, which
is the index.
And here the value itself of the original date, which will be just date at the index I and here we
are going to use pretty much the same.
So I and just date to the date of the copy date index.
OK, so what will be more correct probably is that we initiate or at first will just would have just
created, created this array is the original date, will just name it original date and copy date.
But we are already done with this exercise if we are going to run this program now.
So build and run it, you're going.
To see that original data, the index zero equals to one and also the copy dead, and also you can see
the same values for each of these indexes.
So this is how you copy an array.
You don't use just the assignment operation like these, like data equals to date because that won't
work.
It probably won't even run to you guys.
And my guess.
Yeah, this is it for this video.
Now you know how the copy how you can copy an array and it may be an array of integers, an array of
floating points, an array of charges and so on.
This is how you copy arrays.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.