C comments

C comments

Comments are used for increasing readability of the program. comments are explain what is the purpose of the program and are used to helpful in understanding the program. generally C language comments are written inside the delimiters ex- /* comments */.
The comments may be single line or multiple line. we can write comments anywhere in the program

Now lets take example of comments to understand

// variable A to represent Average salary (Single line comment)
/* variable A to represent Average salary and this is program for find average salary */ (multi line comment)

Given below are 3 important points regarding comments:

1. The space should not be between the // (forward slashes) Take the examples

/    / is incorrect. because there is space between forward slashes
as same, there should not be any space between the slash and star characters in
/* and */ correct
/* and *    / incorrect.

2. Comments do not nest, Example /* programming */ comment has no special meaning inside /* */ Similarly, // comment has no special meaning inside

3. should not write comments inside character literals (such as characters enclosed between single quotes). Comments inside String literals (such as, the text enclosed between double-quotes) are behave as part of the String’s content.

The example of single line comment

#include<stdio.h>
int main()
{
// printing string
printf("This is c program");
return 0;
}

The example of Multi line comment

#include<stdio.h>
int main()
{
/* printing string this is multi line comment */
printf("This is c program");
return 0;
}