Horizon Posted January 3 Share Posted January 3 We all know that every ‘,’ matters in this language, so I decided to talk directly about that character today. So, how much impact can be for such a small little character? It’s just ‘,’ – The Comma Operator by Coral Kashri From the article: This operator comes from C, where it tells the compiler to evaluate all the expressions (left to right) and to return the result of the latest evaluated expression. For example: int a, b; a = 5, b = 4, b += a, ++a, std::cout << b << " " << a; // Prints 9 6 Another example of that operator usage is as follows: for (size_t i = 0, k = 500; i < 10; ++i, ++k) { /*...*/ } We can see this operator in action in the third section of the for statement. It evaluates the ++i and then evaluates ++k.View the full article Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.