Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    A declaration is a statement in C++.Lecture 2 - slide 8 : 42
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);
}