title: How do you pass a function into another function. Tips and pointers?
body: <p>This is code that finds the root of any function that returns a double. I can't find the error, it keeps saying it expects "primary expression before double' the double being the double in front of the function I pass into the function. This is my first time trying to pass a function into a function, so I'm sure that's why I'm getting the error</p>
  
  <pre><code> #include &lt;cmath&gt;
   #include &lt;iostream&gt;
  
  double bisection(double start, double end, double tol, double &amp;(f)(double x) ){
  
  
  double x = end - start;
  double num = f(x);
  if( num &lt; tol){
      return x;
  }
  
  if( num == 0){
      return x;
  }
  
  if( num &lt; 0){
      start = num;
      bisection(start,end,tol, double &amp;(f)(double x) );
  }
  else if(num &gt; 0){
      end = num;
      bisection(start,end,tol, double &amp;(f)(double x) );
      }
  }
  
  double fn(double x){
      return (  (1/sqrt(400 - x*x)) + (1/sqrt(900 - x*x))  - 0.1 )  ;
  }
  </code></pre>