Static variables in C++ -


Look at this pseudo code today I ran into an interesting issue:

  zero loop () {Fixed int x = 1; Printf ("% d", x); X ++; } Zero main (zero) {while (true) {loop (); }}  

Even if X is stable, why does not this code just print "1" every time? I'm starting X1 again on every repetition before printing it. But for any reason, expected increments in the form of X.

The start of a stable variable is only for the first time. After that, the example is shared in the functions in all calls.


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -