Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'          declaration-statements/less-localized.cc - Declarations before statements - C89 Style.Lecture 2 - slide 8 : 29
Program 1

double g(int a, double d){
  return a * d;
}

void f(double p){
  int i = 0;            
  double result;        // Local variable result declared before the first statement.

  //...
  if (p <= 10.0) i++;   // Some statements here              
  //...

  result = g(i,p);      // result first used much later in the function.

  /* The rest of f comes here */
}

int main(){
  f(5.0);
}