QP School

Full Version: Commenting out code in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Example:

int x = 10; // Initialize the value of x to 10
// int y = 20; // This line is commented out and won't be executed

Explanation:

Single-line comments are often used to comment out lines of code that are not needed at the moment.
In this example, the second line (int y = 20Wink is commented out, so it won't be compiled or executed.
Developers use this technique for temporarily disabling code without deleting it, which can be useful during testing or debugging.