The ++
operator works on variables and expressions returning references to something writable, not on all values in general. In other words, there is simply no way to write the value of an incremented char
back into the original string, so charAt(0)++
is an error.
You can work around this problem by converting argv[0]
to an array of characters, and incrementing a value inside that array.