3 ms·
Adding two characters isn't strictly needed for that -- you're relying on the assumption that (c - 'a') is of type character, but it's actually the offset betwe
by moring 7y ago
Adding two characters isn't strictly needed for that -- you're relying on the assumption that (c - 'a') is of type character, but it's actually the offset between two characters. The rules for those two types would be:
char + char = invalid
char + offset = offset + char = char
offset + offset = offset
char - char = offset
char - offset = char
offset - char = invalid
offset - offset = offset
Given that, (c - 'a') + 'A' is perfectly valid without adding two characters.
edit: formatting