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

Recommended Answers

All 3 Replies

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.

double with this. Closed

Be a part of the DaniWeb community

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