------------------ COMMON MISTAKES WHEN PROGRAMMING IN C ------------------- (1) Failure to end line with semicolon (2) Forget to declare variable (3) Forget to put & in front of input variables Example: scanf("%f %f",x,y); (4) Forget to put \n into printf statement Example: printf("The answer is %d",x); (5) Use of , rather than ; in for loop statement Example: for (i=0, i<10, i++); (6) Use of = instead of == in if statement Example: if (x = 0) y = 1; (7) Forget to include math library (or forget -lm for Sun compiler) (8) Mismatched curly brackets, { and } (9) Mismatched comment indicators Example: /* test program /* or /* test program *\ (10) Mismatch between format and variable list (11) Naming your program test.c (or other UNIX command) (12) Use of parentheses rather than square brackets for arrays Example: int x(10); (13) Putting a blank character following the data format in a scanf statement Example: scanf("%d ", &ix);