EE150 - Fall 1996

C Programming
Style Guidelines


Introduction

One question that comes up every semester is: Must the programs we write look like the programs in the course textbook? That is, do we have to indent programs in the same way, use the same long variable names, and so on?

The short answer is: Yes!

The longer answer, however, is, well, not exactly.

The basic rule is that your programs must be easy to read. Things like consistent indentation make programs easier to read. If you indent like we do (and, in general, layout your programs like we do), you'll find your programs are as easy to read as ours. However, we realize that not everyone has the same sense of aesthetics as we do. So, we are not fascists about how our programs look, but we are picky. If we get confused in trying to understand your programs, we're going to take off points (and your program grade is based in part on how readable your programs are).

Some Guidelines

Here are some of the guidelines we use in determining how to grade your program for "readability":

Your goal should be to avoid the mistakes shown above. If you do, you are likely to get full credit.

One last thing. This style guide will be expanded as we show more and more C constructs, so you might want to check back here before starting each assignment to see what we have added.