Interview Questions

Do all declarations for the same static function?

C Interview Questions and Answers


(Continued from previous question...)

Do all declarations for the same static function?

Do all declarations for the same static function or variable have to include the storage class static?

The language in the Standard does not quite require this (what's most important is that the first declaration contain static), but the rules are rather intricate, and are slightly different for functions than for data objects. (There has also been a lot of historical variation in this area.) Therefore, it's safest if static appears consistently in the definition and all declarations.

(Continued on next question...)

Other Interview Questions