0

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 : ')'"

4
Contributors
6
Replies
19
Views
3 Years
Discussion Span
Last Post by whatthebobo
Featured Replies
  • 1

    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. :-) Read More

  • You two errors on line one for (index = 1; index < SIZE; ++); for (index = 1; index < SIZE; ++index) {...} Read More

1

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. :-)

0

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 '{'"

1

You two errors on line one

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

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

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

Edited by whatthebobo: written above

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.