In C++, the --> operator is not a valid operator. The --> operator is often mistakenly used in place of the decrement operator -- followed by the greater than operator >.
The decrement operator -- reduces the value of a variable by 1, while the greater than operator > is used for comparison between two values. When combined, the -- followed by > operator sequence forms the compound operator -->.
C++ example code snippet that demonstrates the usage of the --> operator sequence:
//C++ code for explaning --> operator #include <iostream> using namespace std; int main() { int a = 10; int b = 5; if (a-- > b) { cout << "a is greater than b" << endl; } else { cout << "b is greater than a" << endl; } cout<<"Value of a: " << a; return 0; }
a is greater than b
Value of a: 9
No comments:
Post a Comment