❔ Can anyone help explain what it's talking about?
Is it trying to get me to copy the array value from arrayOne to arrayTwo? If so, how? It never taught me that, only how arrays work.
22 Replies
Arrays - C#
Store multiple variables of the same type in an array data structure in C#. Declare an array by specifying a type or specify Object to store any type.
- what is this "it" that never taught you
- yes, you are suppose to copy the elements of arrayOne into arrayTwo by iterating over arrayOne
- arrayTwo should not have been declared with values defined, just a size matching arrayOne
- if you know how arrays works then you can do the requested task.
* read the value of arrayOne index 0 and write it to arrayTwo index 0 and so forth for each index
I understand the basic of what it is but I guess not to this point unless we were to assigned arrayTwo to equal arrayOne
like this
string[] arrayOne = arrayOne
Would like to read it but if I tried.... I'm not learning anything
How does reading something = not learning?
Cause it just doesn't make sense if I read it
Someone explaing it through video is easier for me to learn
Protip: you can set the value of an array at a given index using
theArray[index] = newValue
That and a loop should be all you needThank you, I'll mess around and see what I can do
Quick question do we use the arrayTwo?
Well, yes
That's the task, isn't it?
To copy values from one array to the other
Got it, just maklng sure
oh, well I mean for the theArray[index]
That's also the way to access a value at a given index, yes
Angius
REPL Result: Success
Console Output
Compile: 701.185ms | Execution: 113.469ms | React with ❌ to remove this embed.
You only change one number. I have to copy all of the vaule from arrayOne to arrayTwo
That's where the loop comes in
Oh, so do
Wait
is arr arrayTwo? if so then where is the value of arrayOne?
Get the specific item from arrayone
Insert 0th item from arrayOne into 0th spot in arrayTwo, 1st into 1st, and so on
Could you show me?
How do you iterate over an array using a for loop?
Here, I highlighted the relevant parts
Hm? What about those? Shoulden't it be covered in the for loop?
The first highlight shows you how to set an item in the array at index
1
The second shows you how to get an item from the array at index 0
You want to insert an item from the first array's index n
to the second array's index n
Where n
is, well, each index
That's where the loop comes in((Sorry got out of school but i'm back))
I think I got it....
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.