Dave's Brain

Browse - Programming Tips - How can I use #ifdef to comment out code?

Date: 2015jun4
Language: C/C++

Q.  How can I use #ifdef to comment out code?

A.  Here's one way:

#if 1 == 0 // The code in here will not be compiled since 1 doesn't equal 0 #endif

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.