C Comments

By | September 24, 2023

Prerequisite – C Language Introduction

C comments explain code and improve readability. These do not affect program execution. You can use comments in C to clarify code and describe algorithms.

There are two types of comments in C: single-line (//) commnets and multi-line (/* */) comments.

1. Single-line comments start with “//” and end at the end of the line.

Example:

//this is a single line comment

2. Multi-line comments start with “/*” and end with “*/”.

Example:

/* This is a multi-line comment
Expand multiple lines */

Single-line comments can also be placed at the end of code lines.

 

Please write comments below if you find anything incorrect. A gentle request to share this topic on your social media profile.

Author: Mithlesh Upadhyay

Mithlesh Upadhyay is a Computer Science and AI expert from Madhya Pradesh with strong academic background (BE in CSE and M.Tech in AI) and over six years of experience in technical content development. He has contributed tech articles, led teams, and worked in Full Stack Development and Data Science. He founded the w3colleges.org portal for learning resources.