I am currently writting a code for my programming class and have come across this error. I do not know how to fix it and was wondering if someone can help me or give me some hints.

for (index = 1; index < SIZE; ++);
    {
            if (values[index] < lowest)
            {
                    lowest = values[index];
            }
    }

error: "project_5.cpp(44): error C2059: syntax error : ')'"

Recommended Answers

All 6 Replies

First, array indices in C/C++ are zero-based, not 1 based like some languages we won't mention here, UNLESS you want to skip over the first element...
Secondly, you need to remove the semi-colon from then end of line 1. :-)

sure well said; on line 1 ; is the bad fox.

when I take off the ; in line one it now has an error that says:
"project_5.cpp(45): error C2143: syntax error : missing ';' before '{'"

You two errors on line one

for (index = 1; index < SIZE; ++);

for (index = 1; index < SIZE; ++index)
{...}

ohh okay. thank you so much!!

I edited this post and put it to a new thread since this is marked solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.