title: Uninitialized local variable used? yet initialized? whats the problem
body: <p>Why do i keep getting uninitialized local vairables in the second function even though i already did initialized them?</p>
  
  <blockquote>
    <p>Error C4700   uninitialized local variable 'x1'<br>
    Error C4700   uninitialized local variable 'x2'</p>
  </blockquote>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  bool is_prime(int n, bool is_prime = 0)
  {
      for (int i = 2; i &lt; n; i++)
      {
          bool is_prime = true;
          if (n % i == 0)
              is_prime = false;
      }
      return is_prime;
  }
  
  int sumPrime(int , int )
  {
      int x1, x2; // keeps saying its unitialized
  
      int sum = 0;
      for ( x1; x1 &lt; x2; x1++)
      {
          if (is_prime(x1))
          {
              sum += x1;
          }
      }
      return sum;
  }
  
  int main()
  {
      int n1, n2;
      cout &lt;&lt; " enter two ns" &lt;&lt; endl;
      cin &gt;&gt; n1 &gt;&gt; n2;
      cout &lt;&lt; sumPrime(n1, n2) &lt;&lt; endl;
      return 0;
  }
  </code></pre>