Question: Write a function in C language called nth that finds the n-th occurrence of a particular value in an array of integers. The first argument

Write a function in C language called nth that finds the n-th occurrence of a particular value in an array of integers.

The first argument is an integer array.

The second argument is the length (size) of the array (i.e., the number of integers).

The third argument is the value you want to match (an integer).

The fourth argument is n, the particular match you want to find. In other words, n=1 means the first occurrence in the array, n=3 means the third occurrence, etc. You may assume that n is greater than or equal to one.

The return value is the index of the n-th match in the array, or -1 if there is no such match.

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!