Then, if you're not using OS specific libraries, repeat all the above steps on a different operating system.
These are all easy and free ways to significantly improve your code, and they will catch a large percentage of the worst problems. Beyond this, the field expands, and once you have taken these easy, free steps, then look further.
You should also do at least some dynamic analysis of your code. Run it under valgrind on Linux. This will flag up significant memory errors you might be making.