I think the close reason isn't applicable here. This is a case of someone who doesn't understand some fundamental concepts of the language, and these error messages will certainly be encountered by others who begin to wet their feet in function pointers and do not yet have a solid understanding of function pointers and function signatures.
1) It wasn't a typographical error. It's not as if he accidentally fat-fingered the series of keys consisting of "sort_ins(v,n)". It wasn't a typo. He clearly intended to type exactly this. The error was not the result of a typo, it was the result of a lack of understanding of function signatures.
2) "a problem that can no longer be reproduce" is also completely wrong. I can certainly reproduce this problem. This close reason is intended for problems where no one can reproduce the problem, and the asker is unable to provide enough details to clarify the scenario in which the problem occurs. You can easily reproduce this error with code given. In fact, he did a pretty good job of providing just enough code to identify the problem. How rare is that? We usually either get pages of irrelevant code, or we get too little code where the error is not related to any of the code shown. He actually took the time to at least inspect the error and provide the code surrounding the context of the error, as well as provide declarations of the functions being passed as arguments.
3) A novice programmer will not immediately understand that "void expression" translates to "a function(or other expression) that returns void" and "invalid use of" is too vague to indicate to them that the function signature does not match the expected signature.
If there was a close reason that was appropriate, it would be the deprecated close reason of "too localized". However, even then I think there is an answer that would have been enlightening to a larger group of novice developers who encounter this error. I think anyone venturing into function pointers for the first time is likely to stumble on these things until the understand the concepts of function signatures. I would have tried to bridge the gap in understanding between the error message, and get them to pay attention to function signatures:
The first parameter to the test1
function expects this signature:
int (*order) ( int[] , int )
...however sort_ins
has a signature with a different return type of
void
instead of int
:
void (* )(int v[],int n)
See the difference between these two? These are called function signatures, and they must match.
That is the source of the first
"invalid use of void expression" because you are passing a function
that returns void(a void expression) when it expects an int return
instead of void.
You have exactly the same problem with inicializacion, as it returns
void as well.
After fixing those two errors, it'll probably be more obvious that the
"too few arguments to function ‘test1’" error is because you've only
passed two arguments to test1 instead of four, missing the last ,int v[],int n)
.
This is really a case of people not remembering what it was like when you first started programming and have all these non-descript errors flying at you.
If he doesn't take the time to try and make the connection after such an answer, then he needs to step back and re-familiarize with the fundamentals. I think it's reasonable to make an attempt to fill the gap between the vague(relative to a novice) error and link that to the concepts of function signatures.
It's also a case of really stretching the meaning of a close category as per my points #1 and #2, just to serve a desire to close a question that rubs you the wrong way. I know I'm gonna get a flood of downvotes, but you can't deny that it wasn't a typo and it is certainly reproducible.