Challenge: Set the Odd Elements in a Dynamic Array to -1
Explore how to modify elements in a dynamic array by writing a function that sets all odd integer values to -1. This lesson guides you through handling pointers, array sizes, and conditions while practicing dynamic memory manipulation in C++.
We'll cover the following...
We'll cover the following...
Problem statement
Your task is to write a function set_odd. In function parameters, we will pass:
-
Pointer
arrthat will point to an array of typeint...