Question: Write a C program that finds the positions of the first two zeros of an input array, and it should set all of the intervening

Write a C program that finds the positions of the first two zeros of an input array, and it should set all of the intervening values (if any) to zero. If the array only contains one zero, if it contains no zeros, or if the first two zeros are right next to each other, the program should NOT modify the array. As part of the solution, write and call the function setZeros() with the following prototype. n is the size of the array. In writing function setZeros(), you may include calls to function findZero(). Name your program set0s.c

void setZeros(int a[], int n);

Example input/output #1:

Enter the length of the array: 6

Enter the elements of the array: 8 0 1 3 0 5

Output array: 8 0 0 0 0 5

Example input/output #2:

Enter the length of the array: 6

Enter the elements of the array: 8 0 1 3 7 5

Output array: 8 0 1 3 7 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!