Any reason not to choose "0" in this linear search?

Hello!
Here is the program code!
I wonder, if it is important if we put any other number instead key=0, or is there a reason that it must be exactly "0"?

Many thanks!
(we are searching if the key value is element of the field!)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  int FindLinear(int field[],int value, int key)
{
   for (int i=0; i<value; i++)
        {
         if (field[i]==key)
             return i;
        }
        return -1;
}

int main(){
const int field_value=100;
int field2[field_value];

for (inr i=0; i<field_value; i++)
field2[[i]=2*i;

int key, result;
do
{
cout <<"write key value.";
cin>>key;

if (key!=0)
{
result= FindLInear(field2, field_value, key);

if (result!=-1)
cout<<"This value is in the filed on index: "<<result;

else
cout<<"This value is not in the field.";
}

}


while (key!=0);
return 0;
}


for (int i=0; i<
Topic archived. No new replies allowed.