1. ( n = 10) instead of ( n == 10)
2. Arrays start at [0]. The last valid element of
char xline[10]
is xline[9], and it contains the null character \0
3. Confusing the value, address and contents of a variable:
| x | value of x |
| *x | value of the cell pointed to by x |
| &x | the address of x |
Remember: the compiler will not catch [1] and [2], and it only catches [3] in function calls. The computer does what you say, not what you mean:
I really hate this darn machine;
I really wish they'd sell it;
It never will do what I want;
But only what I tell it.
| stdio.h | Standard input/output | |
| stdlib.h | Assortment of functions, including random number generator and | memory allocation |
| math.h | mathematical functions | |
| string.h | string functions |