At the cat hotel, each cage has the cat's tag number, in order in the array tags. Write find_cat(tags, n, tag) to return the position (counting from 0) of the cat with number tag; if it appears twice, the first one; if it is not there, return -1.
find_cat({12, 40, 7}, 3, 40)→1find_cat({12, 40, 7}, 3, 99)→-1int find_cat(int tags[], int n, int tag)int find_cat(int tags[], int n, int tag) {
for (int i = 0; i < n; i++) {
// your code here: if the number matches, return i
}
return -1;
}
Run tries the examples. When they look right, Submit.