xxxxxxxxxx
(pointer_name)->(variable_name)
The -> operator in C or C++ gives the value held by variable_name to structure or union variable pointer_name.
xxxxxxxxxx
--> is not an operator. It is in fact two separate operators, -- and >.
The conditional's code decrements x, while returning x's original (not decremented) value, and then compares the original value with 0 using the > operator.
To better understand, the statement could be written as follows:
while( (x--) > 0 )
xxxxxxxxxx
/**
* @author Charles Salvia (StackOverflow)
*
* -> is to access a member function or member variable of an object through
* a pointer, as opposed to a regular variable or reference.
*/
// For example: with a regular variable or reference, you use the . operator
// to access member functions or member variables.
std::string s = "abc";
std::cout << s.length() << std::endl;
//But if you're working with a pointer, you need to use the -> operator:
std::string* s = new std::string("abc");
std::cout << s->length() << std::endl;
xxxxxxxxxx
std::cout, << is used to write to standard output
std::cin, >> is used to read from standard input.