Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          declaration-statements/localized.cc - A declaration is a statement in C++.Lecture 2 - slide 8 : 29
Program 2

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);
}