How does one represent the empty char?
Solution 1:
You can use c[i]= '\0'
or simply c[i] = (char) 0
.
The null/empty char is simply a value of zero, but can also be represented as a character with an escaped zero.
Solution 2:
You can't store "no character" in a character - it doesn't make sense.
As an alternative you could store a character that has a special meaning to you - e.g. null char '\0'
- and treat this specially.
Solution 3:
The empty space char would be ' '
. If you're looking for null that would be '\0'
.