Read the OS class assignment recommendations.
Go through the OS class tips for C usage.
Run your code through a static/dynamic checker (as also stated in the link above). cppcheck and valgrind come into mind.
You may also run your code through the Linux kernel's checkpatch.pl
: http://wintergreenworks.wordpress.com/2012/05/30/checkpatch-linux-coding-style-check/
Use a header with logging macros. Nice links: