Answers

Question and Answer:

  Home  Embedded Software Engineer

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

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.

 189 views

More Questions for you: