As the title suggest how can i declare a variable inside loop and use it outside?
EXAMPLE
void Function(String s)
{
    for(i = 0; s[i] != '\0'; ++i)
    {
        switch(s[i])
        {
            case 'i':int x;
            case 'd':double x;
            case 'c':char x;
        }//end of switch
    }//end of for loop
    //now i want to use 'x' here,i.e.,out side the loop how will i do it?
}//end of void function
EDIT I know the scope thing but i saw some one achieving this with template class/function but I dont know how to use template class/func to do this..so anyone knows?
 
     
     
    