Alvaro wrote:The expression `A[B]' just means `*(A+B)'. A string constant has type `const char *', and its value is the address of the first character of the string, so
"foo"[var] == *("foo"+var),
which is the character `var' places after the beginning of the string constant.
An even more obscure way of doing the same thing is reversing the operands, like this:
variable["some string here"]
That makes sence. So "foo" (in your example) transforms to an integer?
Lets say that "foo" = 5. So writing
cout << "foo"[var]
cout << var
BTW: If we find the best hand are we allowed to output all types of hand if we output the best one first? ie, say that a hand both have Two Pair and flush, am I allowed to print both of them IF I print flush first?