Write the complete function that receives a two-dimensional array of type float and divides each element in the array by two. The array has 3 rows and 4 columns. Define your function in the same way as the given function prototype.  #include #include void divide2Darray(float array[][4]); int main() { float two_d_array[3][4] = {{2.2, 2.4, 2.8, 8.0}, {2.2, 2.4, 2.8, 4.0}, {2.2, 2.4, 2.8, 4.0}}; divide2Darray(two_d_array); printf("%0.2f %0.2f %0.2f %0.2f", two_d_array[0][0], two_d_array[0][1], two_d_array[0][2], two_d_array[0][3]); return 0; }

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

C code Blocks

Write the complete function that receives a two-dimensional array of type float and divides each element in the array by two. The array has 3 rows and 4 columns.

Define your function in the same way as the given function prototype. 

#include <stdio.h>
#include <stdlib.h>

void divide2Darray(float array[][4]);

int main()
{
float two_d_array[3][4] = {{2.2, 2.4, 2.8, 8.0},
{2.2, 2.4, 2.8, 4.0},
{2.2, 2.4, 2.8, 4.0}};
divide2Darray(two_d_array);
printf("%0.2f %0.2f %0.2f %0.2f", two_d_array[0][0], two_d_array[0][1],
two_d_array[0][2], two_d_array[0][3]);
return 0;
}

//Your answer starts here.

For example:

Test Result
float two_d_array[3][4] = {{2.2, 2.4, 2.8, 8.0}, {2.2, 2.4, 2.8, 4.0}, {2.2, 2.4, 2.8, 4.0}}; divide2Darray(two_d_array); printf("%0.2f %0.2f %0.2f %0.2f", two_d_array[0][0], two_d_array[0][1], two_d_array[0][2], two_d_array[0][3]); 1.10 1.20 1.40 4.00
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning