C Comments

Updated

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.

Comment
Next tutorial
Mithlesh Upadhyay Published 24 Sep 2023 · 1 min read

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.

Topics:

Related tutorials

  • Call by value, call by address and call by reference in C++

    The parameters of the function call are known as actual parameters and the parameters of the function definition are known as formal parameters. There are 3 ways of…

    3 min read
  • Delete an element or a range from a set in C++ STL

    Delete an element from the Set by passing its value : Approach : In this method, an element is deleted by using the erase function and calling it…

    3 min read
  • Four Pillars of Object-Oriented Programming (OOPS)

    Get an overview of four pillars of object-oriented programming (OOP) and see their suitable real life examples. What is OOP? Picture a cluttered garage?️. Tools are scattered everywhere,…

    4 min read
  • What is Overriding in C++

    Write a program in C++ to depict the concept of overriding or Dynamic polymorphism. Overriding is a type of polymorphism. Polymorphism in OOP languages means to take more…

    2 min read
  • What should we use void main() or int main() ?

    There is question that what should we use void main() or int main() ? void main() { /* ... */ } Or, int main() { /* ... */…

    2 min read
  • C Programming Language Standard

    Prerequisite – C Language Introduction The C programming language has various versions: C89/C90, C99, C11, and C18. GATE CS 2027 Online Test Series72 tests in the real GATE…

    2 min read