I've been stuck at this for a long time. How can I fix this error?
1 Answer
Easily fixed. You have a function called sort, but it doesn't have the correct form. Here's what you have:
void sort(int values[], int n);
//all the code for the function
The correct form is this:
void sort(int values[], int n)
{
//all the code for the function
}
Get rid of the semicolon and add the curly braces and it should work.
BTW, the void
is not the problem. It is perfectly appropriate to return nothing, indicated by void
.
If this answers your question, please accept this answer to remove the question from the unanswered question pool. Let's keep up on forum housekeeping. ;-)
Edit: One additional note. There is a time when it would be appropriate to have void sort(int values[], int n);
You would do that early in the program when you need to place the prototype ahead of main
because you haven't placed the entire coded function there.