TIL the "#" of C# was based on a small grid of 4 "+" signs, implying it is an increment of C++

You should be able to string along any number of operators and operands in (as far as I know) all C-based languages. For example: ++++++C is the same as C+=3, and should resolve as (++(++(++C))). The reason this works is because that operators in C (and the major C-based languages such as C++, C#, Java, etc.) are considered functions, and functions have the characteristic of always returning a value (note that void is technically a value, so when declaring a C function that returns a void, it still technically returns a value [the value just simply isn't used]). The pre-increment operator (++C) works in this order: First it increments the the operand and then returns the operand. The post-increment operator works in this order: First it creates a copy of the operand, then it increments the original operand, and finally it returns the value of the copy (which was the value of the operand before you incremented it). With this knowledge, we can safely say that it is possible to string along any number of increments onto an operand.

That being said, ++C++ MIGHT (and probably should when talking about C and C++ STANDARDS) be considered undefined behavior since you technically don't know which incrementation would be resolved first, and therefore cannot be certain what the value of C would be once the operators have been resolved. An example as to why this is:

C = 1
(++(C++))
(++(1++))
(++1) | C = 2 
returns (2) | C = 2

C = 1
((++C)++)
((++1)++)
(2++) | C = 2
returns (2) | C = 3

Wait a second... Why did that happen? Well, in many implementations, pre-increment returns a reference to the original operand, since creating a new variable in memory that has the same value as the original operand is somewhat wasteful. Post-increment does not however, since it must increment the value of the operand and must also return the value of the operand before it was incremented. If the compiler resolves the order of operation like the first example then the first incrementation returns a separate copy of C, and this copy is pre-incremented. HOWEVER, if the compiler resolves the order like the second example then the first incrementation returns the initial operand, not a copy, so the initial operand is post-incremented resulting in the operand being incremented twice, but the result will be a copy of the operand having been incremented once.

tl;dr sure you can do it, but it's not suggested that you do so since it might not compile as you think it will on every compiler.

/r/todayilearned Thread Link - en.wikipedia.org