Tricky Tricks ›› Programming Tricks ›› C Languages Tricks ›› Quick Commenting

Quick Commenting

C Programming Tricks

Quick Commenting:

Because C does not allow nested comments, sometimes it is annoying to comment blocks of code. You can utilize the C Preprocessor's #if directive to circumvent this:

   #if 0
     /* This code here is the stuff we want commented */
     if (a != 0) {
       b = 0;
     }
   #endif
 

Partners