0

I've been stuck at this for a long time. How can I fix this error? in the for loop line why this expected identifier error message is showing..

2

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.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .