SequentialSearch error: expected primary-expression before 'OTHER' token

1
2
3
4
5
6
7
8
9
10
11
12
int SequentialSearch(const vector<int> &randnumvect, int search)
{
	int i;
	
	for(i=0;i<randnumvect.size();i++)
	{
		if(search == randnumvect[i])
			return i;
	}
	
	return –1;
}

I get the error after return -1;
There are actually four errors, all after the same line:
Two of them say: "expected primary-expression before 'OTHER' token"
The other two say: "expected ';' before 'OTHER' token"

I don't know what 'OTHER' token is.
Can somebody please help me?
The code you showed is fine. You may forgot a brace or semicolon before this. Something like that
I modified it so i equals -1 if its not found an it returns i. Now it works fine
Topic archived. No new replies allowed.