Common errors
- Dereferencing a null pointer. Segmentation fault (core dumped)
- Array index error: A[10]. An unrelated variable changes
value, with
unpredictable consequences.
- if (x=0). Assigns 0 to x, and takes false branch.
- Missing arguments to procedures: strcmp(buffer).
- Missing declarations: sin(x) without #include
<math.h>.
- Semicolon at end of procedure or function header:
myproc(int a, int b, int c);
{
}
Causes a million syntax errors.
- Referring to math library routines without loading the math library.
Compile or load command must end with -lm.
- Forgetting to declare types of arguments.
- No ``then'' keyword with ``if''.
- If-else statements must have BOTH parts end with semicolons.
- if (x==0) statement, NOT if
x==0 statement .
- C source filename must have ``.c'' suffix
- Use double quotes ("), not single quotes to denote
char strings