Changes

Jump to: navigation, search

Team Mighty Morphin Coding Rangers - OOP344

427 bytes added, 10:21, 2 February 2010
Coding Style, declare variables at the beginning of blocks
<li>Class names must begin with a capital letter</li>
 
<li>Declare each variable at the beginning of blocks.</li>
<code>
Eg.
main () {
int length = 0; // correct, at the beginning of the block
...
...
int flag = 1; // incorrect, at the middle of the block
if ( length = 0){
int i = 0; // correct, at the beginning of the block
...
...
bool valid = true; // incorrect, at the middle of the block
}
return 0;
}
</code>
 
<li>Declare each variable in a line by itself. It is easier to comment a variable this way. Do not use commas to separate the variable names if they have the same data type.</li>
1
edit

Navigation menu