QP School

Full Version: Using multi-line comments for explanations in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.