Clear Global Variables

How to clear global variables every time we run a method?
Like in the above code it should be reset all power vector to 0 every time we enter myPow method.But It’s not happening.

Code:

``````> vector<double> power(10000000,0.0);
>
> class Solution {
> public:
>
>
>     double rPow(double v,long long q)
>     {
>         cout<<v<<" "<<q<<" ";
>         if(q==0) return 1;
>         if(q==1) return v;
>
>         if(power[q]!=0)
>         {
>
>             return power[q];
>         }
>
>         if(q%2)
>         {
>             double val= v*rPow(v,q/2)*rPow(v,q/2);
>              power[q]=val;
>               cout<<"cale"<<" "<<power[q]<<"\n";
>             return val;
>         }
>         double val2=rPow(v,q/2)*rPow(v,q/2);
>         power[q]=val2;
>           cout<<"calo"<<" "<<power[q]<<"\n";
>         return val2;
>     }
>     double myPow(double x, int n) {
>
>        power.clear();
>         cout<<power[10]<<"\n";
>          int val=0;
>         if(n<0)
>         {
>             val=-1;
>            long long k=n;
>             k*=(-1);
>
>             double res= rPow(x,k);
>             double ans=1/res;
>             return ans;
>         }
>
>         return rPow(x,n);
>
>
>
>
>     }
> };``````