Challenge: Remove Even Integers From an Array
Here is a short guide to these challenge lessons.
- The function definition is always given in the problem statement with the expected arguments and function name to be used as is in the solution. If you change it, your code will not compile.
- The skeleton code given has a function definition which only has the
// Replace this placeholder return statement with your codecomment in the body, It’s just there as a placeholder. Delete it and add your code in.
- When you do get compile-time errors, they will sometimes refer to line numbers and code which you did not write. That is fine; that is just our evaluation code. Although, rest assured that our code compiles. When in doubt refer to the solution given and paste that in.
- Sometimes you are going to have to return from functions in a form that aligns with the test cases. Your solution may not be incorrect but your form of returning might not be what the evaluation code expects. For example, you might return two numbers in an Array, but our test cases might expect an Array. Watch out for that. Good luck! 🍀
Implement a function
removeEven( int *& Arr, int size ) which takes an array
arr and its size and removes all the even elements from a given array.
An array with integers and its size
Note: The array passed to the function has been created dynamically.
An array with only odd integers
Arr = [1,2,4,5,10,6,3]
Arr = [1,5,3]