I guess after reading the program, many things are clear to most of the people. Now, I would like to move your focus on the double backslash ( //), which plays an important role while writing complex programs in C language.
We humans are in a habit to keep a note of everything, which remind us to keep a follow-up of all the things we need to keep a track off. In the same way, C gives us flexibility to put a comment at any place where there is a possibility of confusion. Now, following are few useful tips to write a comment.
- There are two formats to write a comment in C lang. They are as follows:
a) put double backslash ( // ) in every line before the starting of the comment.
For example: // C lang is cool
// I am learning C lang just for fun
OR b) enclose a comment within /* */.
Start a comment with a single backslash with an asterick ( /* ) and then at the end of the
comment put an asterick with a single backslash ( */ ). A comment can be split over
more than one line. for e.g.
/* My
name is
Samiha */
- We can add any number of comments in a single program. But they cannot be nested.
For example: /* C lang /* is very easy */ */ - ( It is Invalid)
I hope a simple way of adding a comment to your program will help you to make your program user friendly & this will save your time to get the hold of the program whenever you try to figure out what the program does.
Wednesday, May 21, 2008
Comments in 'C' lang
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment