title: Randomly changing variable
body: <p>I'm trying to find an instance of an int in an array, and then print out the index of that int. The problem is the variable I'm using to store the number I'm checking keeps changing in the middle of inputs.</p>
  
  <pre><code>int num, size;
  int arr[size];
  
  cin &gt;&gt; num &gt;&gt; size;
  
  for (int i = 0; i &lt; size; i++){
      cin &gt;&gt; arr[i];
  }
  
  for (int i = 0; i &lt; size; i++){
      if (arr[i] == num){
          cout &lt;&lt; i &lt;&lt; endl;
          return 0;
      }
  }
  
  return 0;
  </code></pre>
  
  <p>The input is this:</p>
  
  <pre><code>23
  12
  1 3 5 7 9 11 13 15 17 19 21 23
  </code></pre>
  
  <p>While inputting the array arr, the variable num changes to 13 when arr[6] is assigned. What is causing the variable to switch?</p>