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
Jump to PostIf 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.
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.