Question: A developer has written the following search function that you need to examine for any potential problems. What will the function return if the key

A developer has written the following search function that you need to examine for any potential problems. What will the function return if the key value is not in the vector?
```
int myfunction(vector& v, int key)
{
int index =0;
while (index v.size() && key != v[index])
{
if (v[index]!= key)
{
index++;
}
}
return index;
}
```
0
-1
v.size()
v.size()-1
A developer has written the following search

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 Programming Questions!