QP School
Single-Line comment within code in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: Single-Line comment within code in C (/showthread.php?tid=5127)



Single-Line comment within code in C - Qomplainerz - 07-26-2023

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.