why "'cont' was not declared in this scope"

void setup() {

pinMode(6,OUTPUT);
pinMode(2,INPUT);
int vel;
int cont=0;
}

void loop() {
if (digitalRead(2)==HIGH)
{if (digitalRead(2)==LOW)
{cont++;}
}

switch(cont)
{
case 0:
break;

case 1: //encendido al nivel 1
for (int inc=0;inc<100;inc++)
{analogWrite(6,abs(inc));delay(5);
}//for

case 2: //encendido nivel 2
for (int inc=0;inc<150;inc++)
{analogWrite(6,abs(inc));delay(5);
}//for
break;

case 3: //encendido nivel 3
for (int inc=0;inc<200;inc++)
{analogWrite(6,abs(inc));delay(5);
}//for
break;
case default:
cont=0;
break;
}//switch
}//void loop

Where IS it declared?

I´m new on this, I was thinking it was declared in the part:

void setup{ int cont=0;}

Move that above 'void setup()' to make it a global variable rather then local.

Then, Google 'C language variable scope'. Sorry, on a phone or I'd post a link.

Thanks a lot man:D it works...

Putting that above, program compiled. I didnt know about global and local variables

Sorry my bad english