Experianced programmars always leave a comment after writing important code lines so that they or anybody can understand easily later. This is a good method for understanding to the new less exprianced programmars.
To comment in a program, you’ve to write in a definited area. You can write comment in a single line or more in the middle of /* your comments here */ . Compiler don’t compile these area. Now write the following program and run it to understand well.
Code:#include <stdio.h>
int main()
{
printf("Hello World!");
/* We have printed Hello World.
Note: this is a multi-line comment */
return 0;
}
See the result. The result is only “Hello World!” because the compiler didn’t compile the /*-------- */ area.
Output:
No comments:
Post a Comment