QP School

Full Version: Single-Line comment within code in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Example:

int age = 25;
if (age >= 18) {
    printf("You are an adult!\n");
    // Handle adult-related actions here
} else {
    printf("You are a minor.\n");
    // Handle minor-related actions here
}

Explanation:

Single-line comments can be used within the code to provide additional details about specific sections.
In this example, the comments inside the if and else blocks explain that different actions can be handled based on the age of the person.