Embedded Software Engineer Question:

Tell me can static variables be declared in a header file?

Tweet Share WhatsApp

Answer:

A static variable cannot be declared without defining it. A static variable can be defined in the header file. But doing so, the result will be having a private copy of that variable in each source file which includes the header file. So it will be wise not to declare a static variable in header file, unless you are dealing with a different scenario.

Download Embedded Software Engineer PDF Read All 100 Embedded Software Engineer Questions
Previous QuestionNext Question
Please explain what is interrupt latency? How can you reduce it?Tell me what is NULL pointer and what is its use?