Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODING PROBLEMS: 1. Write a function that takes an array of NON-ZERO integers (of type ine) and its size (the number of elements in the

image text in transcribed
CODING PROBLEMS: 1. Write a function that takes an array of NON-ZERO integers (of type ine) 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 The array (95) is alternating (according to our convention, as a one-element array). The function should return 1 2. Write a function that reverses the string supplied as a parameter, ie the very first symbol of the string becomes the last one, the second one-next to the last, and so on. The parameter is an array of elements of type char. The function should change the array in place, ie, it has to change the actual array passed as the parameter. You can assume that the function receives a real string. i.e., a valid array of characters with character indicating the end of the string This is the function's declaration: void ReverseString(char str[]); Please keep in mind that str could be an empty string too. In that case stro) would be equal to Hint. You can use strien(str) to return the length of the string. In order to use it, you have to put the following #include directive to your source file: #include Examples Input: "Hello" Input: "CAT" Output: "oller" Output: "TAC Output: "A" Input: "A

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Development For Dummies

Authors: Allen G. Taylor

1st Edition

978-0764507526

More Books

Students also viewed these Databases questions