Note: This post has been revised based on the discussion in the comments under this answer. Most of the inflammatory comments/remarks from the previous version of this answer have been removed.
Let me preface this by saying that nobody should ever be punished for trying to be a positive contributor to the community.
I, for one, do not have any experience in this tag. However, the question seems to tick all the boxes for a question to be an topic—
- Has a meaningful title
- Introduces/describes the problem well
- Describes the warning along with the code that produces it
- Has associated code sample
From first glance, your question should not have been closed, even if the answer did not address it properly.
What should've been done was a constructive comment left, possibly a downvote (I'd expect it based on the user(s) you were dealing with), and possibly a better answer, as Hans noted. This did happen sans answer, however I do not approve of the manner in which it was done.
What instead happened was that someone took it upon themselves to punish you for the answer you wroteAdditionally, by posting a close vote requestyour question was posted on the SO Close Vote Reviewers chatroomfor auditing, and upon further inspection, was closed by other users with experience in the C tag (link redacted, see edit history for link).
The specific close vote reason given wascited there was—
too broad ("someone make my code compliant" - self-answered, not useful for future readers)
Thankfully, sanity has prevailedUpon further review, and a moderator reopened your question. If this happens again, I'd recommend flaggingwhich I'm glad has been done. I did not agree with the closure of your question for moderator attention and explaining, but apparently I'm in the situationminority. I'll let the majority vote win out here.