pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/cpp/comments-cpp.md

ithubassets.com/assets/global-81a5f61ff87ac6f0.css" /> cpp-docs/docs/cpp/comments-cpp.md at main · MicrosoftDocs/cpp-docs · GitHub
Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 1.38 KB

File metadata and controls

22 lines (15 loc) · 1.38 KB
description Learn more about: Comments (C++)
title Comments (C++)
ms.date 11/04/2016
helpviewer_keywords
code comments, C++
comments, documenting code
comments, C++ code
white space, C++ comments
ms.assetid 6fcb906c-c264-4083-84bc-373800b2e514

Comments (C++)

A comment is text that the compiler ignores but that is useful for programmers. Comments are normally used to annotate code for future reference. The compiler treats them as white space. You can use comments in testing to make certain lines of code inactive; however, #if/#endif preprocessor directives work better for this because you can surround code that contains comments but you cannot nest comments.

A C++ comment is written in one of the following ways:

  • The /* (slash, asterisk) characters, followed by any sequence of characters (including new lines), followed by the */ characters. This syntax is the same as ANSI C.

  • The // (two slashes) characters, followed by any sequence of characters. A new line not immediately preceded by a backslash terminates this form of comment. Therefore, it is commonly called a "single-line comment."

The comment characters (/*, */, and //) have no special meaning within a character constant, string literal, or comment. Comments using the first syntax, therefore, cannot be nested.

See also

Lexical Conventions

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy