Commenting out code
You can comment out one or more lines of code. The leading characters //
are added to the beginning of each line.
Tip: The characters /* */ on lines that already are
already commented out are not affected when you comment and uncomment code as
To comment out code:
- In the C/C++ editor, select the line(s) of code that you want to comment out. If no lines are selected comments will be added (or removed) at the current cursor positition.
- Right-click and do one of the following:
- To comment out the selected code, select Comment.
- To remove the leading // characters from the selected
line(s) of code, select Uncomment.
Instead of using the context menu (right click) you can quickly comment out by pressing CTRL+/ or remove comments by pressing CTRL+\.
Customizing the C/C++ editor
Working with Content Assist
C/C++ editor preferences