CMSC104 - C Indentation Styles
Choose one of the two styles and use it consistently:
Student Style | Bell Labs Style |
---|---|
if (condition) { statement(s) } |
if (condition) { statement(s) } |
if (condition) { statement(s) } else if (condition) { statement(s) } else { statement(s) } |
if (condition) { statement(s) } else if (condition) { statement(s) } else { statement(s) } |
for (loop control expressions) { statement(s) } |
for (loop control expressions) { statement(s) } |
while (condition) { statement(s) } |
while (condition) { statement(s) } |
do { statement(s) } while (condition); |
do { statement(s) } while (condition); |
switch (integer expression) { case constant1: statement(s) case constant2: statement(s) default: statement(s) } |
switch (integer expression) { case constant1: statement(s) case constant2: statement(s) default: statement(s) } |
Last Modified: Monday, 29-Jan-2007 19:50:04 EST