Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C: error: expected ')' before ';' token

Tags:

c

This seems like the simplest code, but I don't know why it won't compile:

    switch(choice) {
        case 0:
            printf("%d", LOOP_LIMIT); /* this line gives the error */
            break;
        case 1:

when I comment out the line it compiles fine

like image 754
ahota Avatar asked Mar 05 '13 18:03

ahota


People also ask

How do you fix expected unqualified ID before token?

– Adjust the Curly Braces To Fix the Expected Unqualified Id Error. You should match the opening and closing curly braces in your code to ensure the right quantity of brackets. The code should not have an extra or a missing curly bracket.

How to solve expected identifier before'('token in C?

Solution 2Adding a semicolon to a function definition turns it into a forward declaration - which can't have a body. Remove the semicolon at the end of the "main" line. int r = scanf("%d-%d-%d", &x, &y, &z); You will need to do the same thing with printf as well.

What is meaning for expected')'before token?

It literally means what it's saying. You're missing an important parenthesis there, bud. Check your code before you hit the semicolon.

What does error')'expected mean?

It means the syntax is invalid.


1 Answers

Your code has something like this:

#define LOOP_LIMIT 10;
                     ^
                    Remove this semicolon.
like image 120
nos Avatar answered Sep 21 '22 23:09

nos