This article is from the alt.comp.lang.learn.c-c++ Frequently Asked Questions. Compiled by Sunil Rao email@example.com.
Before posting code here, try and make sure that it at least compiles correctly, even if it does not quite behave the way you intended it to. Try and localise your error to a particular function or section of code - most readers have no time to wade through pages of code (If you are unable to do this, you probably need to start again from scratch anyway.). Do NOT under any circumstances post all of your code as an attachment - many will simply ignore your post. Please also specify if your code is C or C++. Essentially, post the smallest complete program that manifests the problem. This makes it easier for the reader to answer your question. You might find that doing this enables you to answer your question yourself!
Read the answer to the above question as well. And do learn how to use the debugger that came with your compiler. It usually helps if you set the warning levels to the highest possible for your compiler - let the compiler pick out any errors and warn you of any potential problems. And if you post any errors or warning messages with your code, it makes it that much easier for a regular to see what's wrong with your code - any need to compile it yet again will be minimised, especially if the error is a common one.