I have a program like this
int main(){
char c;
int i; /* counter */
double d;
return 0;
}
if I want to comment out char, int and double, and just have return uncommented, can I do it? the comment that's already there stops the comment.. Is there an easy/fast way to comment that out?
int main(){
#if 0
char c;
int i; /* counter */
double d;
#endif
return 0;
}
Not strictly a comment, but the effect is what you want and it's easy to revert.
This also scales well to larger code blocks, especially if you have an editor that can match the start and end of the #if..#endif
.
int main(){
/*
char c;
int i; // counter
double d;
*/
return 0;
}
If your compiler supports the //
notation for comments (non-standard in C, but quite commonly supported), use an editor that can toggle a whole block of lines with these.
In C99
int main(){
// char c;
// int i; /* counter */
// double d;
return 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With