Friday, February 27, 2009

Comments

Most of the time when you see a source code of a program, you will notice there are some lines of code that look like this:
//this program displays the message hello world
The above is to display a line of comment only. If more than 1 line of comments will be used, Refer below:
/*
this allows the program to run the functions....
and this is a block of text
*/
These are comments. Comments are added into the source code so that other programmers understand what are you trying to do in your code. This further helps in code maintenance as well in finding bugs in the program. The compiler ignores any line of statements that starts with the // symbol or the /* symbol. To close a comment, or rather finish commenting, simply add */ after the comment.

No comments: