Sunday, July 12, 2015
Common Errors in C programming language
In my ten plus years of C programming I make a lot of errors while typing programs. Some of them are syntax errors which are caught by the compiler. Some of them are not.
1. putting = instead of == in boolean expressions
2. Not explicitly casting parameters
This is usually caught by modern compilers in the form of warning messages.
3. Not handling integer overflows
If they are two unsigned integers x and y (x+y) will be positive if and only if (x+y) does not overflow
4. Not initializing variables
Not initializing variables leads to unpredictable results
5. Array subscripts
If you have an array of size n assigning a (n+1)th object should lead to a runtime error
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment