Home » Blog » Describe static function with its usage?

Describe static function with its usage?

A function, which has a function definition prefixed with a static keyword is defined as a static function. The static function should call within the same source code.

In C, functions are global by default. The “static” keyword before a function name makes it static. Unlike global functions in C, access to static functions is restricted to the file where they are declared. Therefore, when we want to restrict access to functions, we make them static. Another reason for making functions static can be reuse of the same function name in other files.

Leave a Reply

Your email address will not be published.