Tuesday, 6 January 2015

Static Variable

When a function is completed, all of its variables are normally deleted. 

However, sometimes you want a local variable to not be deleted.

To do this, use the 'static' keyword when you first declare the variable






The Output will be shown as:
123

So,each time the function is called, that variable will still have the information it contained from the last time the function was called.
This entry was posted in :

0 comments:

Post a Comment