[Solved] what is the correct way to define a non-alphanumeric char in c++?


You’re reading too much in to the word char.

At the end of the day, it is little more than a size. In this case, 8 bits. Shorts are 16 (and you can wear them on the beach), ints can be 32 or something else, and longs can be 64 (or ints, or a quick conversation with the relevant authorities on the beach as to why you lost both pairs of shorts).

The correct way to define a value in C++ is basically down to what the maximum value that can be held. char_traits::eof() is indeed a good constant, but out of context – means very little.

1

solved what is the correct way to define a non-alphanumeric char in c++?