3
I want to make a function that takes two integer vectors and returns a value Boolean, but when I put the:
return (encontrou);
It keeps error on the variable encontrou
. Follows part of my function:
public static bool verificar(int cont, int m1, int m2, int[] Cobertura1, int[] Cobertura2)
{
bool encontrou;
for (int i = 0; i <= cont; i++)
{
if ((m1 == Cobertura1[i]) &
(m2 == Cobertura2[i]) &
(m1 == Cobertura2[i]) &
(m2 == Cobertura1[i]))
{
encontrou = false;
}
else
encontrou = true;
}
return (encontrou);
}
Related: Why compiler requires local variables to be initialized and fields not?
– Jéf Bueno