c++ input array of char after input int : <p>I have an array of characters with variable size which is received from user input. From there I input the array with for loop based on the size but it seems like the variable holding the size is changing and I'm stuck in infinite loop.</p>

<pre><code>char arr_1[] = {};
int array_size;

cout &lt;&lt; "Array size: ";
cin &gt;&gt; array_size;
for (int i = 0; i &lt; array_size; i++)
{
  cout &lt;&lt; "Input: ";
  cin &gt;&gt; arr_1[i];
}
</code></pre>
