C Compiler Logo

Unmatched Parentheses, Braces, or Brackets

Unmatched Parentheses, Braces, or Brackets

syntax

error: expected ')' before ';' token

Description

Parentheses, braces, or brackets are not properly matched. Every opening symbol must have a corresponding closing symbol.

Common Causes

Example of Error

Error Code

int main() {
    if (x == 5 {
        printf("x is 5\n");
    }
    return 0;
}

Solution

Ensure all opening symbols have matching closing symbols.

Corrected Code

int main() {
    if (x == 5) {
        printf("x is 5\n");
    }
    return 0;
}

Additional Tips