I'm somewhat beginner in C++ and I've faced a problem. I have defined a function inside other function and I assumed that the variables defined in fun1 is just like global variables to fun2; but the compiler says this is not defined in this scope! Is there a way to have some variables that can be passed to fun2 but not to the main or other functions?
Here is the example that returns error:
double fun1(double,double);
int main()
{
    double z,x=1.0,y=2.0;       
    z=fun1(x,y);
    printf("z=%f",z);
    return 0;
}
double fun1(double x, double y)
{
    double fun2(void);
    double q=5.0,w=7.0;
    return x*q+y*fun2();
}
double fun2()
{
    return w;
}   
 
     
    