Challenge: Safe Array Access
Oppgave
Swipe to start coding
Write a function sumArray that takes a constant integer array and its size as parameters and returns the sum of all elements in the array.
- Access only valid indices in the array (from 0 to size - 1);
- Do not use any global variables or additional libraries;
- Declare and initialize the array in
main, then pass it with its size tosumArray; - Return the total sum from the function.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 2. Kapittel 3
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
Suggested prompts:
Can you explain this in simpler terms?
What are the main takeaways from this?
Can you give me an example?
Fantastisk!
Completion rate forbedret til 7.69
Challenge: Safe Array Access
Sveip for å vise menyen
Oppgave
Swipe to start coding
Write a function sumArray that takes a constant integer array and its size as parameters and returns the sum of all elements in the array.
- Access only valid indices in the array (from 0 to size - 1);
- Do not use any global variables or additional libraries;
- Declare and initialize the array in
main, then pass it with its size tosumArray; - Return the total sum from the function.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 2. Kapittel 3
single