In the code editor, you are provided with an array called, life. Furthermore, in the main(), a function call was made to the function displayOdd() where the array life was passed as well as the size of life which is 90. Your task is to declare and define the function displayOdd() which has the following details: Return type - void Name - displayOdd Parameters int* - an array int - the size of the array Description - displays all the odd numbers found in the array passed, starting from the end. Output Odd element at index 80: 33 Odd element at index 77: 69 Odd element at index 76: 17 Odd element at index 73: 15 Odd element at index 69: 101

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 6E: (List maintenance) The following letters are stored in an alphabet array: B, J, K, M, S, and Z....
icon
Related questions
Question

(C PROGRAMMING ONLY)

2. Odd Life
by CodeChum Admin

In life, anything can happen. Yesterday we're happy, tomorrow we're sad. One moment we're up, the next we're down.

 

Life's odd. But that's what makes it beautiful ?

 

In this program, let's try displaying all the odd numbers of our array, life, but with the use of functions!

 

Instructions:

In the code editor, you are provided with an array called, life. Furthermore, in the main(), a function call was made to the function displayOdd() where the array life was passed as well as the size of life which is 90.
Your task is to declare and define the function displayOdd() which has the following details:
Return type - void
Name - displayOdd
Parameters
int* - an array
int - the size of the array
Description - displays all the odd numbers found in the array passed, starting from the end.


Output

Odd element at index 80: 33
Odd element at index 77: 69
Odd element at index 76: 17
Odd element at index 73: 15
Odd element at index 69: 101
.
.
.
.

int main(void) {
int life[9®] = {
1,3,2,4,5,7,6,8,9,11,
100,13,0,14,16,17,3,18, 20,10,
12,8,15,14,-5,17,19,18,1,9,5,
10,13,11,14,16,22,0,18, 20,3,
99,13,15,14,22,17,19,0, 23,2,
12,13,15,22,16,17,56,18,44,99,
2,13,22,14,16,89,19,69,101,34,
12,22,15,14,78,17,69,18,2,33
};
displayodd(life, 90);
return 0;
// TODO: Define the displayodd () function here
Transcribed Image Text:int main(void) { int life[9®] = { 1,3,2,4,5,7,6,8,9,11, 100,13,0,14,16,17,3,18, 20,10, 12,8,15,14,-5,17,19,18,1,9,5, 10,13,11,14,16,22,0,18, 20,3, 99,13,15,14,22,17,19,0, 23,2, 12,13,15,22,16,17,56,18,44,99, 2,13,22,14,16,89,19,69,101,34, 12,22,15,14,78,17,69,18,2,33 }; displayodd(life, 90); return 0; // TODO: Define the displayodd () function here
main.c
< > + c
1 #include<stdio.h>
2
3 /| TODO: Declare the displayodd() function here
4
5 int main(void) {
int life[90] = {
7
1,3,2,4,5,7,6,8,9,11,
100,13,0,14,16,17,3,18,20,10,
12,8,15,14, -5,17,19,18,1,9,5,
10,13,11,14,16,22,0,18,20,3,
99,13,15,14,22,17,19,0,23,2,
12,13,15,22,16,17,56, 18,44,99,
2,13,22,14,16,89,19,69,101,34,
12,22,15,14,78,17,69,18,2,33
};
8.
9.
10
11
12
13
14
15
16
17
displayodd(life, 90);
18
19
return 0;
20 }
21
22 /| TODO: Define the displayodd() function here
23
Transcribed Image Text:main.c < > + c 1 #include<stdio.h> 2 3 /| TODO: Declare the displayodd() function here 4 5 int main(void) { int life[90] = { 7 1,3,2,4,5,7,6,8,9,11, 100,13,0,14,16,17,3,18,20,10, 12,8,15,14, -5,17,19,18,1,9,5, 10,13,11,14,16,22,0,18,20,3, 99,13,15,14,22,17,19,0,23,2, 12,13,15,22,16,17,56, 18,44,99, 2,13,22,14,16,89,19,69,101,34, 12,22,15,14,78,17,69,18,2,33 }; 8. 9. 10 11 12 13 14 15 16 17 displayodd(life, 90); 18 19 return 0; 20 } 21 22 /| TODO: Define the displayodd() function here 23
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT