Home > Backend Development > C++ > body text

What does /* mean in c++

下次还敢
Release: 2024-04-26 18:27:13
Original
362 people have browsed it

In C, "/" and "/" are multi-line comment symbols, used to comment out blocks of code so that they will not be executed by the compiler. Specific usage includes: /* Mark the beginning of the comment. */ Marks the end of the comment. The content of the comment can be multiple lines of text and does not need to end with a semicolon (;).

What does /* mean in c++

##The meaning of / and / in C

In C,

/* and */ are multi-line comment symbols.

Purpose:

    Comment out the code block so that it will not be executed by the compiler.
  • Write comments to explain the function of the code, algorithm or other relevant information.

Usage:

  • /* Marks the beginning of the comment.
  • */ Marks the end of the comment.
  • The content of the comment can be multiple lines of text and does not need to end with a semicolon (
  • ;).

Example:

<code class="cpp">// 使用单行注释
int main() {
  // 这是一条单行注释
  return 0;
}

/*
使用多行注释
*/
int main() {
  /*
  这是一个多行注释
  它跨越了多行
  */
  return 0;
}</code>
Copy after login

Note:

    Comments will not be processed by the compiler, Therefore, it will not affect the operation of the program.
  • Comments can be nested, but the number of nesting levels must not exceed 64.
  • The closing symbol (
  • */) of a nested comment must be on the same line or at the same level of nesting as the opening symbol (/*). Otherwise, the compiler will generate an error.

The above is the detailed content of What does /* mean in c++. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
c++
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!