- Do not stop when a program first produces the expected output; also check readability, maintainability, efficiency, and robustness.
- Store computed results in variables before displaying them. Program state matters more than transient console output.
- Analyze control flow and data flow, then verify your reasoning with a debugger or temporary diagnostic output.
- When requesting help, explain what you tried, what you understand, and the precise point that remains unclear.
Detailed Guides
- Whitespace in a
scanf format usually consumes any amount of input whitespace. Character input needs extra care because it may read a pending newline. - Match each format specifier to its destination type, and include
& when an address is required. - Use ASCII punctuation in source code and end statements with an ASCII semicolon.
- Declare and initialize variables before reading their values.
- Integer division produces an integer result, even if that result is later assigned to a floating-point variable.
- When Microsoft Visual C warns about functions such as
scanf, understand the safer alternatives first. Legacy exercises may require _CRT_SECURE_NO_WARNINGS.
Programming Style