double g(int a, double d){ return a * d; } void f(double p){ int i = 0; // ... if (p <= 10.0) i++; // Some statements // ... double result = g(i,p); // Declaration of result the first time its is used. /* Rest of f comes here */ } int main(){ f(5.0); }