Comments in C
Comments are notes written in source code for humans. The compiler does not treat them as executable program instructions.
Single-line comment
| // This is a single-line comment int age = 20; // stores the age |
Multi-line comment
| /* This is a multi-line comment. It can contain several lines. */ |
Program with comments
| #include <stdio.h> int main() { /* Add the numbers printf(“Sum = %d”, sum); return 0; |
| OUTPUT Sum = 30 |
| ⭐ EASY TIP: Use comments to explain why something is being done, especially when the logic is not obvious. |