Thursday, April 15, 2010

A Simple C Program - Comment

How do we need to save the C programs?

As we know if you want to save the in excel the extension followed by the name of file ('.xls' for 2003 Excel). By using the same scenario we need to save C programs depending on what application you are using.

The C program is saved as the file name followed by the extension '.c' in the case of simple C compiler application. You can easily observe that the program mentioned in the above image is saved as '02L01.c'.

For DOS application we can save the same program file as '02L01.exe' .

Comments


You notice that this line starts with a combination of a slash and an asterisk, /* ( called opening comment mark), and ends with */ ( called closing comment mark).The C compiler ignores everything between the opening comment mark and closing comment mark while executing the program.

The first line in the program '/* 02L01.c: This is my first C program */' is a comment.

The performance speed of the executable file made from your C program is not affected by the comments inside your C program. You can give as many as comments in the program. It will not increase the size of the executable program file.

Use of comment is FOR - For Our Reference. Comment is like notes that you will get to understand what exactly it is about so that third person can understand it.

/*
This comment does not increase the size of
the executable file (binary code), nor does
it affect the performance speed.
*/

which is equivalent to this:

/* This comment does not increase the size of */
/* the executable file (binary code), nor does */
/* it affect the performance speed. */










No comments:

Post a Comment