TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    C++

    C++ Comments

    Overview

    C++ comments are explanatory notes that the developer adds to the program source code. These notes will help others to understand the code and the logic.

    C++ comments are ignored by the compiler. They are meant for humans to increase the readability of the code. C++ supports two types of comments:

    • Line comment / Single-line comment
    • Multi-line comments

    Line comment

    Single line comment starts with // and may extend to the end of the line.

    // This is an example single line comment

    Multi-line comment

    C++ multi-line comments start with /* and end with */ and can span multiple lines. This comment is mostly used for blocks of code like program header, function header, etc.

    /*

    *  This is a sample multi-line

    *  C++ comment.

    */

     

    C++ Comments

    Example

    In the example, the first comment is a multi-line comment. We can include information like author name, program description, file name, date, change history, etc. Commercial programs may also include license and copyright information.

     

    /************************************
    * C++ Comments
    * Filename: comments.cpp
    * C++ Tutorials - www.TestingDocs.com
    * This is an example of multi-line
    * comment
    *************************************/
    #include 
    using namespace std;
    // Example of single line comment
    int main()
    {
     int studentNo; // valid identifier
     studentNo = 1001;
     cout << studentNo << endl;
     return 0;
    } // end main

    —

    C++ Tutorials

    C++ Tutorials on this website:

    https://www.testingdocs.com/c-coding-tutorials/

    For more information on the current ISO C++ standard

    https://isocpp.org/std/the-standard

    Related Posts

    g not found OpenSuse

    C++ /

    Install GCC C++ Compiler on OpenSuse

    sum of digits c program

    C++ /

    Sum of Digits of a Number C++ Program

    C++ Hello World Program

    C++ /

    C++ Hello World Program

    C++ /

    Object-Oriented Programming Language Examples

    C++ /

    Object-Oriented Programming Features

    ‹ C++ Identifiers› C++ Intrinsic data types

    Recent Posts

    • Running Tests in Parallel with Selenium Grid
    • Advanced Selenium Features
    • Locating Web Elements
    • Running the Test Script
    • Writing Your First Selenium Test Script
    • Getting Started with Selenium Automation Testing
    • Setting Up the Environment
    • How can you monitor the Quality Assurance Audit?
    • Leveraging LambdaTest with Appium 2.0
    • Appium 2.0 Plugins ListAppium 2.0 Plugins
    • Touch Actions and Multi-Touch Actions
    • Changes in Drivers and Classes
    • Appium Inspector
    • Capabilities in Appium 2.0
    • Appium 2.0 Driver ListAppium 2.0 Driver Installation & Management
    CyberLink Multimedia Software

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com