title: How do I get a variable from one function into another?
body: <p>Exactly like the title says, how can I get my disc variable from my discr function into my calcRoots function?</p>
  
  <pre><code>// Function calculating roots
  bool calcRoots(double coeffs[], int coeffLength, double roots[], int rootLength) {
     if(disc &gt;= 0) {
        roots[rootLength - 1] = ((-(coeffs[coeffLength - 2]) + sqrt(disc)) / (2*(coeffs[coeffLength - coeffLength])));
        roots[rootLength - rootLength] = ((-(coeffs[coeffLength - 2]) - sqrt(disc)) / (2*(coeffs[coeffLength - coeffLength])));
        return true;
     }
     else {
        return false;
     }
  }
  
  // Solves the discriminant
  double discr(double coeffs[], int coeffLength){
     double disc = (pow(coeffs[coeffLength - 2],2)-4*coeffs[coeffLength - coeffLength]*coeffs[coeffLength - 1]);
     return disc;
  }
  </code></pre>