Comments in C

Home / C Programming / Comments in C

Comments in C


Comments in C programming are used to provide explanatory or descriptive information within the code. They are ignored by the compiler and do not affect the execution of the program. Comments can be helpful for documenting code, making it easier to understand and maintain. There are two types of comments in C:


Single-line comments: Single-line comments begin with two forward slashes (//) and continue until the end of the line. They are typically used for short explanations or comments on a single line.

Multi-line comments: Multi-line comments, also known as block comments, start with /* and end with */. They can span multiple lines and are often used for longer explanations or commenting out blocks of code.