Commenting using the preprocessor
suggest changeLarge chunks of code can also be “commented out” using the preprocessor directives #if 0
and #endif
. This is useful when the code contains multi-line comments that otherwise would not nest.
#if 0 /* Starts the "comment", anything from here on is removed by preprocessor */ /* A large amount of code with multi-line comments */ int foo() { /* lots of code */ ... /* ... some comment describing the if statement ... */ if (someTest) { /* some more comments */ return 1; } return 0; } #endif /* 0 */ /* code from here on is "uncommented" (included in compiled executable) */ ...
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents