Comments in a C program

Everything between those two points is ignored by the compiler.

Single line Comment

// This is how a single line comment looks in the C language

#include

main(){

int i,j,k;

i = 6;

j = 8;

k = i + j;

printf("sum of two numbers is %d \n",k);

// This is single line comment

}

Multiline Comments.

/* This is how a Multi line comment looks in the C language */

The beginning of the comment is marked by the slash and the asterisk: /*.

The end of the comment is marked by the asterisk and the slash: */.

Example 1.

#include

int main(){

/* This is the

comment.*/

printf("%15s","right\n");

printf("%-15s","left\n");

return(0);

}

No comments: