Question: c programming 1. Write a function that takes an array of NON-ZERO integers (of type int) and its size (the number of elements in the
1. Write a function that takes an array of NON-ZERO integers (of type int) and its size (the number of elements in the array) as arguments, and checks if the array is alternating (positive and negative elements follow each other). The function should return value of type _Bool: 1 - if the array is alternating: 0 - if the array is not alternating. You can assume that the array has no elements with value 0, so, you do not need to make this additional check. Convention: We will treat a one-element array as alternating. This is the declaration of the function and the first line of its code, which determines the size of the array passed to the function as a parameter: _Bool IsArrayAlternating(int arr[], size_t arr_size); Please write the actual definition of the function above. Examples: The array (-3, 1,-5, 7, -235) is alternating. The function should return 1; The array (100, 95, -73, -10,-1000) is not alternating. The function should return 0. The array (95) is alternating (according to our convention, as a one-element array). The function should return 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
