1.

What are local static variables? How can you use them?

Answer»

A local static variable gets defined in a specific BLOCK and is accessible locally INSIDE that block only. However, because it is static, its value is persistent. Its lifetime does not end when a function call is declared. Instead, its lifetime EXTENDS throughout the PROGRAM. Local static variables can be used for counting the number of times a particular function is called.



Discussion

No Comment Found