14

I am using a Codeblocks IDE for C++ and I tried googling it, but could not find the answer.

How do I comment out a block of code in Codeblocks? For example in Eclipse its ctrl+7.

1
  • 4
    Code::blocks is an IDE, not a compiler.
    – tdammers
    Commented Mar 13, 2011 at 7:27

6 Answers 6

25

Ctrl + Shift + C to comment selected block

Ctrl + Shift + X to uncomment .

12

A quick google gives me this page, which says it's Ctrl + Shift + C.

1
  • 1
    the fact that the words "block" and "code" are quite common in programming certainly doesn't help google... I did "code::blocks" block comment, which worked well enough.
    – tdammers
    Commented Mar 13, 2011 at 10:57
5

You can do a box comment with /* at the start and */ at the end. It'll block out everything in between.

i.e.

/*This is part of a block comment. 

This is still part of it

This also part of it */

If you just highlight the code you want to comment out and go to Edit --> Box-Comment. It'll do it all for you.

5

Shortcut to Comment highlighted code: Ctrl + Shift + C

Shortcut to Uncomment highlighted code: Ctrl + Shift + X

By the way, You can go with this link and you can search whatever shortcut you want in codeblocks.

3

First, select the code. After that, press Ctrl + Shift + C.

1

There are various functions involving that sort of thing, they're all in the Edit menu

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.