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
Post a Comment