0

erroe2editedsameproblemi've been wasting hours going round in circles. Frustrating that first steps of learning are this hard.code[![error][4]

i;ve removed the semi-colon and moved the curly hash together and separetely to no avail.

1
  • Hi. In the future, please cut and paste code instead of using screenshots for the code itself. (OK, to show results though.) It makes it a lot easier to grab the code for testing and nobody wants to manually transcribe code from a screenshot. Just trying to set you on the right path. thanks.
    – Cliff B
    Commented Dec 18, 2018 at 2:17

1 Answer 1

0

It's simple. There's no semicolon at the end of the line. Each line of code is expected to end with a semicolon.

If there's something more complex going on, it would require seeing the surrounding code to see what is causing the problem.

[EDIT: new screenshot]

This is a very, very common mistake for new programmers, so don't feel bad.

Simple fix: remove the semicolon from the following line:

int main(void)

A semicolon should only be added to the end of a signature line when the full function code appears later. (You'll learn about this later.) The main declaration behaves just like a signature line for a function, but should never be written with a semicolon.

With errors like this, the compiler gets confused because it thinks the line is a function signature, so it keeps going until it sees something that looks wrong, given that the signature line was right. (Or the developers of C think this error is so basic that it doesn't warrant code in the compiler to catch this as an error.)

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • ok i think i've got it. for some reason the answer to this seemed inconsistent and was going around in circles trying either/or's constantly
    – lnuikcek85
    Commented Dec 18, 2018 at 2:28

You must log in to answer this question.

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