Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using multi-line comments for explanations in C
#1
Example:

int x = 5;
int y = 10;
/*
    The following code calculates the sum of two numbers.
    It takes two integers, x and y, as input and returns their sum.
*/
int sum = x + y;

Explanation:

Multi-line comments are often used to provide detailed explanations for code blocks or functions.
In this example, the comment provides an explanation of the code that calculates the sum of two numbers.
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
  Nested multi-line comments in C Qomplainerz 0 974 07-26-2023, 07:27 AM
Last Post: Qomplainerz
  Multi-Line comment within code in C Qomplainerz 0 1,048 07-26-2023, 07:26 AM
Last Post: Qomplainerz
  Multi-line comments in C Qomplainerz 0 1,007 07-26-2023, 07:24 AM
Last Post: Qomplainerz
  Commenting out a part of a line in C Qomplainerz 0 1,088 07-26-2023, 07:19 AM
Last Post: Qomplainerz
  Single-Line comments in C Qomplainerz 0 1,037 07-26-2023, 07:16 AM
Last Post: Qomplainerz
  Command-Line Arguments in C Qomplainerz 0 1,083 07-25-2023, 01:27 PM
Last Post: Qomplainerz
  Multi-dimensional arrays in C Qomplainerz 0 926 07-25-2023, 11:40 AM
Last Post: Qomplainerz
  Multi Line Comments in C 18 Qomplainerz 0 1,391 04-06-2022, 02:24 PM
Last Post: Qomplainerz
  Single Line Comments in C 18 Qomplainerz 0 2,305 04-06-2022, 02:22 PM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 3 Guest(s)