Search code examples
cscopestaticstorage-duration

Static storage class in header file


Can we include static variable in header files. If yes,Can other files can access it ?

Can we include static function in header files and use it in another files.

Can we pass static variable as function arguments ?suppose some function is there in header file header.h :

fun(static int a,static int b)


Solution

  • You can declare static variable in header files but this variable scope will only be that *.c file in which this header file will be included.