You got your 95 from the range 0x21-0x7E (inclusive). Let this number be called "nusable". These are all standard printable characters from ASCII. It excludes spaces / tabs / crs, etc. If the “character” is really a type C char (8 bits), then nusable is 95. Some systems allow built-in spaces in passwords, so be careful, as this will contain numbers up to 96, etc.
If "character" can be any 8-bit byte value, the range will be 0x00-0xFF, and nusable will be 256.
Thus, the practical answer will be 95, except for another encoding. If it was an intro C programming class, this is the likely answer. But, looking at the wording again, I think it means that nusable 256, regardless of the fact that you could not enter it from the keyboard.
From now on, make nusable and the number of valid "characters" in the password, which is specified as 8, and do the math ...
So, if you are limited to ASCII and / or 8 bits, you can stop here.
UTF-8 and UTF-16 use "code points", which can be of variable size when encoded in a string. See https://en.wikipedia.org/wiki/UTF-8 UTF-8 code points are in the range 0x000000-0x10FFFF (maximum 1,111,112), and when encoding it can vary in size from 1 -4 bytes. Note that the ASCII characters at the top are mapped directly to UTF-8 0x00-0x7F code points and are one byte long. This is by design.
So the question is: Is the "character" C a "char":
(1) (char password [8])
or is it a UTF-8 encoded string:(2) (char password [n]) where "n" is large enough to contain 8 codepoints?
The maximum would be n = 8 * 4or recalculated at code points as:(3) uint32_t password [8]
If “character” means code, then searching for the type you need is similar to what you did for ASCII. But not all UTF-8 codes are usable. Some of them are invalid. Some of them are special evacuation codes. Some of them are unassigned and reserved for future use (for example, Klingones, if we ever develop starships :-)). Some of them are intended for special characters, such as a long dash (for example, "-" or "---").
, , . (, , , , , ), (, , )? ?
Windows wchar_t (16 ) UTF-16 . UTF-8 , , .
, 8 [case (2) case (3) ], nusable [ , ASCII ].
[case (1)], . , . UTF-8 . 1 (, 95), 2,..., 4 5 (, int lenlist [5]). , , . . , 8. , ...