c programming tips and tricks

Quick Commenting

Sometimes you may find yourself trying to comment blocks of code which have comments within them. Because C does not allow nested comments, you may find that the */ comment end is prematurely terminating your comment block.

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;

Leave a Reply

Your email address will not be published. Required fields are marked *