Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Single-Line comments in C
#1
In C, single-line comments are used to add explanatory notes or comments to the code that are ignored by the compiler. They begin with the double forward slash // and continue until the end of the line.

Example: Basic Single-Line Comment

// This is a single-line comment

Explanation:

In this example, the single-line comment starts with //.
Anything after // on the same line is considered a comment and is ignored by the compiler.
This comment serves as a simple explanatory note for the code.
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Storing a single character in C Qomplainerz 0 363 07-26-2023, 07:45 AM
Last Post: Qomplainerz
  Using multi-line comments for explanations in C Qomplainerz 0 342 07-26-2023, 07:28 AM
Last Post: Qomplainerz
  Nested multi-line comments in C Qomplainerz 0 265 07-26-2023, 07:27 AM
Last Post: Qomplainerz
  Multi-line comments in C Qomplainerz 0 335 07-26-2023, 07:24 AM
Last Post: Qomplainerz
  Commenting out a part of a line in C Qomplainerz 0 340 07-26-2023, 07:19 AM
Last Post: Qomplainerz
  Single-Line comment within code in C Qomplainerz 0 285 07-26-2023, 07:18 AM
Last Post: Qomplainerz
  Command-Line Arguments in C Qomplainerz 0 289 07-25-2023, 01:27 PM
Last Post: Qomplainerz
  Multi Line Comments in C 18 Qomplainerz 0 815 04-06-2022, 02:24 PM
Last Post: Qomplainerz
  Single Line Comments in C 18 Qomplainerz 0 1,707 04-06-2022, 02:22 PM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 2 Guest(s)