Commenting out code
You can comment out one or more lines of code in any C/C++ editor view. The leading characters // are added to the beginning of each line when commenting one or more lines of code. You can also block comment multiple lines of code using the characters /* */.
Tip: The characters /* */ on lines that already are already commented out are not affected when you comment and uncomment code as described above.
To toggle // comments on 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 start of the lines containing the cursor.
- Right-click and select Source > Toggle Comment. (CTRL+/)
To block comment /* */ code:
- In the C/C++ editor, select multiple line(s) of code to comment out.
- To comment out multiple code lines right-click and select Source > Add Block Comment. (CTRL+SHIFT+/)
- To uncomment multiple code lines right-click and select Source > Remove Block Comment. (CTRL+SHIFT+\)