title: Visual C++ - Runtime Check Failure #3 - Variable is not initiliazed
body: <p>I use Visual C++ 2010 Express Edition to compile and run the .exe files I write in the C++ programming language. I am trying to create a loop-based logic using C++ to ask the user how many entries he chooses to enter, and ask questions limited to that no. of entries. For example I want to output, "How many characters do you wish to enter?: " Say the user gives the answer as '3' which is stored in the int variable 'entries'. I then want to keep asking the question 3 times before it stops and continues with the next line of code. I hope you understand, here is a block of code to demonstrate what I am doing:      </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
     cout &lt;&lt; "How many values do you need to enter?: ";
     int entries;
     cin &gt;&gt; entries;
     int offset, number;
     string valueName[50];
     float valueValue[50];
     for (offset = 0; offset &lt; entries; offset++)
     {
        cout &lt;&lt; "Enter " &lt;&lt; number &lt;&lt; " Value Name: ";
        cin &gt;&gt; valueName[offset];
        cout &lt;&lt; "Enter " &lt;&lt; valueName[offset] &lt;&lt; "\'s value: ";
        cin &gt;&gt; valueValue[offset];
        for (number = 1; number &lt;= entries; number++)
        {
        }
     }
     char response;
     cin &gt;&gt; response;
     return 0;
  }
  </code></pre>
  
  <p>Strangely when I run this simple program, it fails when I enter the value's name to be inserted into the 0th element of the valueName[] array. It just pauses the execution of the program and a dialog box pops up saying "Runtime Check Failure #3 - Variable 'number' is being used without being initialized!" Another problem regarding this program is that, for quite some time, when I ran this program this "Runtime Check Failure #3" box never appeared, and when it didn't, the number value went wrong, and first started with 1, and then for the next loop jumped to 6, and then repeated 6 again for the next loop! <br>Please help me! I've checked online scouring this problem everywhere, but it just doesn't apply to my type of problem! <br>Is it because the variables are out of scope? <br>But they're declared outside the for loops right?  <br><br>So please help me!</p>