Challenge: Safe Array Access
Uppgift
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
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 2. Kapitel 3
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Suggested prompts:
Can you explain this in simpler terms?
What are the main takeaways from this?
Can you give me an example?
Fantastiskt!
Completion betyg förbättrat till 7.69
Challenge: Safe Array Access
Svep för att visa menyn
Uppgift
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
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 2. Kapitel 3
single