comparing multiple variables..
I have an array of ints in my program and in main it goes through a huge series of iterations where the numbers in that array are constantly changed. I have a line in main that throws that array into a function and in that function I want to check if any 4 consecutive numbers are the same but the way Im doing it does not seem to be working.. heres the basics..
Code:
int main(int argc, char *argv[])
{
.....
if (consecutive(x)==1)
... true
else
...false
....
return 0
}
int consecutive(int *)
{
if (x[0]==x[1]==x[2]==x[3] ||
x[1]==x[2]==x[3]==x[4] ||
x[2]==x[3]==x[4]==x[5] )
return 1;
else return 0;
}
Can I not do it this way? Because even when there are 4 consecutive matching numbers it will still return a false.. but it doesn't seem to do so all the time.