A compiler error can make a tiny mistake feel larger than it is. The useful move is to slow down: look at the line the compiler names, read the message, then check the line just before it.
Start with a small program
Save this as small-bug.c. It is short enough that we can keep the whole program in view:
#include <stdio.h>
int main(void) {
int count = 3
printf("count = %d\n", count);
return 0;
}
There is one syntax bug: the declaration of count has no semicolon at the end. In C, a declaration like this is a statement, and statements need to be terminated.
Ask the compiler
Compile with a few warning flags turned on:
cc -std=c11 -Wall -Wextra -pedantic small-bug.c -o small-bug
The diagnostic wording depends on the compiler, but it will point near the printf line and complain about the syntax before it. That location is a clue, not always the exact place where the mistake began. The compiler was still expecting the previous statement to finish when it reached printf.