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
- Forgetting to close parentheses in function calls or conditions
- Missing closing braces in blocks of code
- Mismatched brackets in array declarations or accesses
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
- Use an editor with bracket matching to help identify mismatches
- Properly indent your code to make structure clearer
- Count your parentheses in complex expressions