title: Why do I need to initialize an int variable to 0?
body: <p>I just made this program which asks to enter number between 5 and 10 and then it counts the sum of the numbers which are entered here is the code</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  
  using namespace std;
  
  int main()
  {
      int a,i,c;
      cout &lt;&lt; "Enter the number between 5 and 10" &lt;&lt; endl;
      cin &gt;&gt; a;
      if (a &lt; 5 || a &gt; 10)
      {
          cout &lt;&lt; "Wrong number" &lt;&lt; endl;
          system("PAUSE");
          return 0;
      }
      for(i=1; i&lt;=a; i++)
      {
          c=c+i;
      }
      cout &lt;&lt; "The sum of the first " &lt;&lt; a &lt;&lt; " numbers are " &lt;&lt; c &lt;&lt; endl;
      system("PAUSE");
      return 0;
  }
  </code></pre>
  
  <p>if i enter number 5 it should display </p>
  
  <blockquote>
    <p>The sum of the first 5 numbers are 15 </blockquote></p>
  
  
  <p>but it displays </p>
  
  <blockquote>
    <p>The sum of the first 5 numbers are 2293687 </blockquote></p>
  
  
  <p>but when i set c to 0</p>
  
  <p>it works corectly</p>
  
  <p>So what is the difference ?</p>