How to implement comma Segmentation expression in C++
This article will explain in detail how to implement comma segmentation expression in C++. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Comma division expression
A comma expression may contain one or more subexpressions separated by commas, for example:
If (+ + x,-- y, cin.good ())
In the above if expression, each statement is executed, but the condition of the entire if is actually the conditional value of the third expression value of if. The default value of cin.good () is 1, which becomes 0 only if the input value is inconsistent with the defined variable type.
The same is true in loop statements. Such as:
While (+ + I,-- j) {;}
The entire while loop stops only when jig0.
This is the end of the article on "how to implement comma segmentation expressions in C++". I hope the above can be helpful to you, so that you can learn more knowledge. If you think the article is good, please share it for more people to see.