Home Segments Index Top Previous Next

27: Mainline

Note that C is blank insensitive; C treats all sequences of spaces, tabs, and carriage returns—other than those in character strings—as though there were just a single space. Thus, the following are equivalent:

#include  
main ( ) { 
  printf ("The average price is "); 
  printf ("%f", (10.2 + 12.0 + 13.2) / 3); 
  printf ("\n"); 
} 

#include  
  
main ( ) 
{ 
  printf ("The average price is "); 
  printf ("%f", (10.2 + 12.0 + 13.2) / 3); 
  printf ("\n"); 
} 

#include  
main ( ) { 
     printf ("The average price is "); 
     printf ("%f", (10.2 + 12.0 + 13.2) / 3); 
     printf ("\n");} 

#include  
main ( ) {printf ("The average price is "); 
          printf ("%f", (10.2 + 12.0 + 13.2) / 3); 
          printf ("\n");} 

None of these layout options can be said to be “best” or “official.” In fact, some experienced C programmers argue heatedly about how to arrange functions so as to maximize transparency and to please the eye. In this book, the functions are written in a style that both uses paper efficiently and lies within the envelope of common practice.