Consider this code: “int s = 20; int t = s++ + –s;”. What are the values of s and t?
cut to the chase, the answer is “s is 20, and t cannot be determined.” I understand the part that s is 20, but why t cannot be determined? Please help me!
cut to the chase, the answer is “s is 20, and t cannot be determined.” I understand the part that s is 20, but why t cannot be determined? Please help me!
++ is not an operator. It is two + operators. The + operator is the identity operator, which does nothing. (Clarification: the + and – unary operators only work on numbers, but I presume that you wouldn’t expect a hypothetical ++ operator to work on strings.) Parses as Which translates to You have to use the slightly longer += operator to do what you want to do: I suspect the ++ and — operators … Read more