Question: Write a function in C named find_elem which takes the following arguments: integer elem integer array int size with size being the array size, and

Write a function in C named find_elem which takes the following arguments:

integer elem

integer array

int size

with size being the array size, and elem the element you have to find in the array.

If elem is part of the array, return the first position of the element in the array. If elem is not part of the array return -1

For example:

Test Output
int array[] = {4, 2, -6, -1}; printf("%d", find_elem(4, array, 4)); 0
int array[] = {4, 2, -6, -1}; printf("%d", find_elem(-4, array, 4)); -1

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!