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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started