Comment in C / C ++
The comment of the program is the explanation of the code writer in C / C ++ code, helping the reader, checking the source code is easier to understand. All programming languages have their own syntax for commenting.
C ++ supports single-line and multi-line comments. All characters in the comment are ignored by the C / C ++ compiler.
Comment in C / C ++ starts with / * and ends with * /. Below is an example of a single-line comment and multi-line comment in C ++:
/* Day la mot comment don dong */ /* C/C++ cung ho tro cac comment * trai dai tren nhieu dong */
A comment can also start with //, extending to the end of the line. For example:
#include using namespace std; main() { cout << "Hoc C/C++ co ban va nang cao"; // In dong chu Hoc C/C++ co ban va nang cao return 0; }
When the above code is compiled, it will skip // Print C / C ++ and get high results and finally give the following result:
Hoc C/C++ co ban va nang cao
Inside the comment / * and * /, the characters // have no special meaning. Inside the // comment, the characters / * and * / have no special meaning. Therefore, you can "nest" these two types of comments together. For example:
/* Comment ve dong lenh in dong chu Hello World: cout << "QTM xin chao cac ban!"; // in dong chu QTM xin chao cac ban! */
According to Tutorialspoint
Previous article: Basic C ++ syntax
Next lesson: Data type in C / C ++
You should read it
- Good comments in Korean so you can send to idols
- Instructions to turn on 'Rating comments' for posts on Facebook
- Facebook tested the private comment feature, set the right to read comments
- How to use comments, notes (comments) in Word
- Facebook confirms it is testing comments with stickers
- How to hide comments on Threads, filter inappropriate comments Threads
- How to turn off comments in Facebook
- Caption tags in HTML
May be interested
- Data type in C / C ++data type in c / c ++ while working with any programming language, you need to use various types of variables to store information. variables, nothing but memory locations are reserved for saving values. that is, when you create a variable, you reserved some space in memory for that variable.
- Variable type in C / C ++a variable provides named storage so that we can manipulate. each variable in c / c ++ has a specific type, which determines: the size and memory layout of the variable; the range of values can be stored inside that memory; and the set of activities can be applied to that variable.
- Variable scope in C ++we will learn what functions and parameters of functions are in the next chapter. below we will explain the concept of local variables and global variables.
- Hang (Constant / Literal) in C / C ++constant involves fixed values that the program cannot change and they are called literals.