title: Can the C language forget a variable?
body: <p>It sounds very weird, but I noticed that my program crashes because a variable is literally forgotten (turning to 0).</p>
  <p>This is the output of gdb</p>
  <pre><code>...
  709         while (progressione-&gt;avanti !=  NULL) {
  (gdb) p nGiocatori 
  $30 = 4
  (gdb) step
  713         lista_stanze[i] = *progressione; // aggiungo la stanza alla 
  lista
  (gdb) p nGiocatori 
  $31 = 4
  (gdb) step
  731         puts(&quot;&quot;);
  (gdb) p nGiocatori 
  $32 = 0
  (gdb) 
  </code></pre>
  <p>as you can see after <em>puts(&quot;&quot;)</em> the value of <em>nGiocatori</em> is turned to 0.
  The problem is not related to <em>puts(&quot;&quot;)</em> whatever statement in replace of <em>puts(&quot;&quot;)</em> causes the same problem.</p>
  <p>Can anyone explain to me why this strange thing happens?</p>
  <p>(I don't know if it matters or not, but the variable nGiocatori is global and static unsigned short, its value is taken through scanf.)</p>