Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Safe Array Access | Working with Array Elements
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C++ Arrays

bookChallenge: Safe Array Access

Aufgabe

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.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 3
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

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

Swipe um das Menü anzuzeigen

Aufgabe

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.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 3
single

single

some-alt