[prev] [index] [next]

Layout/Indentation

Indentation is very important in displaying structure of code.

Compare the following:

largest = a[0];            |  largest=a[0];
for (i = 1; i < N; i++) {  |  for(i=1;i<N;i++)
   if (a[i] > largest)     |  {if(a[i]>largest)
      largest = a[i];      |  largest=a[i];}
}                          |

Precise indentation conventions have some element of personal taste.

Most important is: Adopt one convention and use it consistently.