Seksjon 1. Kapittel 20
single
Challenge: Clone and Modify
Sveip for å vise menyen
Oppgave
Swipe to start coding
Write a program that demonstrates cloning an array and modifying the clone without affecting the original. You will work with integer arrays.
- The
CloneArrayfunction should create a new array that is a copy of the input array and return it. - The
ModifyArrayfunction should change each element in the provided array by adding 10 to it. - The main execution should show that modifying the clone does not change the original array.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 20
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår