Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Modify Array Values | Using Arrays in Programs
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C++ Arrays

bookChallenge: Modify Array Values

Task

Swipe to start coding

Write a function that modifies every element of an array by doubling its value. Follow these requirements:

  • Declare and initialize the array in main;
  • Pass the array and its size to a function;
  • Use a loop to access each element;
  • Modify the array in place;

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 4
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Modify Array Values

Swipe to show menu

Task

Swipe to start coding

Write a function that modifies every element of an array by doubling its value. Follow these requirements:

  • Declare and initialize the array in main;
  • Pass the array and its size to a function;
  • Use a loop to access each element;
  • Modify the array in place;

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 4
single

single

some-alt