MASIGNASUKAv102
6510051498749449419

C++ Comments - Learn With AVRK

Comments in C++ Language 

C++ comments are those statements which are never executed by the compiler. The comments in C++ programming are used to provide explanation about the code, method or class, variable. 

Loading...

There are two types of comments -
  • Single Line comment
  • Multiline comment


C++ Single Line Comment

These single line comments are starts with double slash (//). Let's look at an example of single line comment in C++.
#include<iostream>
using namespace std;
int main()
{
    int x = 10; // x is a variable
    cout<<x<<"\n";
}

Output -

10


C++ Multiline Comment

These C++ multiline comments are used to comment multiple lines of statements. It is surrounded by slash and asterisk (/∗ ..... ∗/). Let's look at an example of multiline comment in C++.
#include<iostream>
using namespace std;
int main()
{
    /* declaration and
    initialization a variable */
    int x = 15;
    cout<<x<<"\n";
}

Output -

15

Also check out this : 
C++ goto Statement - Learn With AVRK
Learn With AVRK

Learn With AVRK