Question: Using C language Secondary Exercise B Suppose you are given a linear array of size n as shown below n-3 n-2 Now imagine if you
Using C language

Secondary Exercise B Suppose you are given a linear array of size n as shown below n-3 n-2 Now imagine if you wrapped the end of the array so it meets up with the start of the array. This creates a circular array (ring), which conceptually looks like this n-10 In this configuration, any non-negative array index is acceptable by performing a modulo n operation: Example: If n-3, this is how you would wrap the indices User index Actual index Your task is to write a function named circular_array that meets these specifications The first parameter is a numeric array, and the second parameter is its size e third parameter is the desired index, which is non-negative and is allowed to be 2 n .The function determines the value of the element to the "left" of the index and returns it back using the fourth parameter (i.e., via a pointer) The function determines the value of the element to the ..right', of the index and retums it using the fifth parameter (i.e. via a pointer) You may assume that the array contains integers, and its size n will always be greater than zero Example: Let a circular array X be of size n = 5 and contain these values Your function is called like this: circular_array(X, n, k, &left, &right); The values of left and right for various index values of k are Actual index 0 left ri 0 12 0 12 47 12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
