This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Header For this course, each program should contain the following header information Modularization Separate your program into independent, self-complete modules. We’ll discuss this in more detail later. Consistency Make your style as consistent as possible. The more consistent your style, the easier it will be to read and understand your program (not just others, but yourself as well!) Consistency will lead to fewer mistakes. The more consistent your style, the more automatic it will become for you and you’ll spend less time thinking about program style and more about the problem at hand. Indentation Make the indentation of your code reflect the structure of the program. For example, if (count == 0) printf (“No data.\n”); fails to match the structure of the program. It is much better to write this as: if (count == 0) printf(“No data\n”); Here’s another bad example: if (count != 0) printf(“%d\n”, count); average = total/count; This last example is much more clear if it is indented as follows: C Style Guide - 1 COP 3502 – Summer 2002 – C Programming Style Guide COP 3502C – Summer 2002 Lab Number: Assignment Number: Name: Student ID: Date: if (count != 0)if (count !...
View Full Document