If I declared a static variable in a header file, and the header file is included in a couple of .c files. Is there any problem?

Thanks

If this is the same question as your other post please request that a moderator closes this one and direct people to your other one. It's too confusing to have two posts open with the same topic.

Yes it is a problem. Each time you include that .h file, it will define a new static variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.