Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Safe Array Access | Working with Array Elements
C++ Arrays

bookChallenge: Safe Array Access

Taak

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 to sumArray;
  • Return the total sum from the function.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 3
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

Can you explain this in simpler terms?

What are the main takeaways from this?

Can you give me an example?

close

bookChallenge: Safe Array Access

Veeg om het menu te tonen

Taak

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 to sumArray;
  • Return the total sum from the function.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 3
single

single

some-alt