Strange chars printed on exceeding bounds of undefined length char array : <p>I am pretty new to C and I have tried the following code</p>

<pre><code>#include &lt;stdio.h&gt;

int main ()
{
  char str[] = "a";
  for(int x = 0; x &lt; 20; x++)
  {
    printf("%c\t%d\n", str[x],str[x]);
  }
  return 0;
}
</code></pre>

<p>For which I get the following output</p>

<pre><code>a   97
    0
    0
s   115
&lt;   60
�   -62
)   41
P   80
�   -42
�   -128
0   48
�   -41
&gt;   62
�   -119
�   -88
U   85
    0
    0
�   -105
�   -85
</code></pre>

<p>After <code>str[2]</code> the chars are random for each execution, can someone please explain this behavior.</p>
