Putting Comments

  • Putting comments will help the reader of your code on what's going on behind the statements.
  • Comments in C are placed within /* and */. For example:
    /*
       This program does blah blah
       Neat huh?
    */
  • Everything enclosed within the /* and */ are ignored by the compiler.
  • In C++, another style to comment your program is to put the double slash sign (//). Everything behind this sign is treated as a comment. For example:
    // My comment is here
  • It seems that gcc compiler can recognize both styles even in C programs. So, it's up to you which one to use. The rule of thumb is: If the command is one or two liners, use the // sign, but if the command is rather long, use /* and */.

 


Where to go

Chapter 2
News Page
Lesson 1 contents
Contacting Me


Roby Joehanes © 2001

Hosted by www.Geocities.ws

1