I think this may be a case of overzealous reviewing that seems to be on the increase recently (possibly a consequence of actual increase in rubbish indeed, to put this into context).
The first answer you mention is an answer to this question:
A function to compare two sentences in C
I am a beginner in programming. I have a problem in C which I can't
solve. I can't write a function which will print the result of
comparison of two sentences which are entered in program with fgets()
function. The program should print whether or not the entered
sentences are the same. WIll you ehlp me?
And the answer (now deleted) was:
Use strcmp to compare two strings.
Firstly, let's address the question. It was initially closed as "closed as unclear what you're asking" (last week) and deleted today.
Admittedly, it's not the best question around, not necessarily the most researched either, but it could be salvaged quite easily (by first removing unnecessary text like "WIll you ehlp me?", which indeed makes it a low-quality question.)
If we're trying to build SO as a repository of knowledge, having questions about comparing two strings in C seems reasonable. If we're answering questions more generally to help, we can also provide a reasonable answer.
I wasn't involved in any voting in this Q&A, but I'd have look for a duplicate (like this). Surely, this must have been asked before. If there wasn't a duplicate, "unclear what you're asking" doesn't seem like the right close reason (I think it's fairly clear).
Assuming the question isn't bad (which is arguable indeed here), this would be a good criterion to evaluate whether it's a bad, link-only, delete-worthy answer: would this answer still be useful without any internet connection (or with that link being dead).
The answer is yes. It's quite easy to run man strcmp
locally on a Linux machine, for example. Those who consider it a link-only answer probably wouldn't have flagged it up had there not been a link under strcmp
at all. It's not a great answer, but it's certainly correct and points the reader in the right direction. (A much better answer would have come with a short example perhaps.) Unhappy people can still downvote, that's what it's for.
Overall, it's probably best to keep it deleted, because of existing duplicates for this question.
The second answer you mention is very similar:
You could use the strcmp
function: strcmp
Someone put a comment under it saying:
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
I'm afraid this is not a link-only answer. If anything, it does include the essential part of the answer: the name of the function to look for in the documentation.
(In this case, however, I definitely wouldn't have upvoted this answer (and I might have downvoted it), since it seems to miss the point of the question, by offering a solution that seems too simplistic for the general problem (although it would work in basic cases).)
I know I tend to write relatively long answers with details, but it must be said that short answers that go straight to the point (or at least that give the main information requested in the question) have their use. The first case you mention would fit this case (again, provided the question isn't an exact duplicate).