- C++ Introduction
 - C++ Getting Started
 - C++ Syntax
 - C++ Output (Print Text)
 - C++ Comments
 - C++ Variables
 - C++ Declare Multiple Variables
 - C++ Identifiers
 - C++ User Input
 - C++ Data Types
 - C++ Operators
 - C++ Strings
 - C++ Math
 - C++ Booleans
 - C++ Conditions
 - C++ Switch
 - C++ While Loop
 - C++ For Loop
 - C++ Break And Continue
 - C++ Arrays
 - C++ References
 - C++ Pointers
 - C++ Functions
 - C++ Function Overloading
 - C++ OOP
 - C++ Classes And Objects
 - C++ Class Methods
 - C++ Constructors
 - C++ Access Specifiers
 - C++ Encapsulation
 - C++ Inheritance
 - C++ Multilevel Inheritance
 - C++ Multiple Inheritance
 - C++ Inheritance Access
 - C++ Polymorphism
 - C++ Files
 - C++ Exceptions
 - C++ How To Add Two Numbers
 
C++ Comments
C++ Comments
Comments can be used to explain C++ code, and to make it more readable. It can also be used to prevent execution when testing alternative code. Comments can be singled-lined or multi-lined.
Practice Excercise Practice now
Single-line Comments
Single-line comments start with two forward slashes (//).
Any text between // and the end of the line is ignored by the compiler (will not be executed).
This example uses a single-line comment before a line of code:
Example
cout << "Hello World!";
This example uses a single-line comment at the end of a line of code:
Example
Practice Excercise Practice now
C++ Multi-line Comments
Multi-line comments start with /* and ends with */.
Any text between /* and */ will be ignored by the compiler:
Example
to the screen, and it is amazing */
cout << "Hello World!";
Practice Excercise Practice now
Products
Partner
Copyright © RVR Innovations LLP 2025 | All rights reserved - Mytat.co is the venture of RVR Innovations LLP