Home Segments Index Top Previous Next

94: Mainline

You define the doubling_time function as follows:

double doubling_time (double r) { 
  return 72.0 / r; 
} 

Here is what each part of the function definition does:

  *--Tells C the data type of the returned value 
  | 
  |          *-- Tells C the name of the function 
  |          | 
  |          |           *-- Tells C the name and  
  |          |           |   data type of the parameter 
  |          |           | 
  |          |           | 
  v          v           v 
------ -------------  --------  
double doubling_time (double r) {  <-- Marks where the body begins 
  return 72.0 / r; 
  ------ -------- 
    ^        ^ 
    |        | 
    |        *-- Provides the value to be returned 
    |      
    *-- Indicates that a value is to be returned by the function 
  
}  <-- Marks where the body ends