The ASCII character set only defines 128 characters (0 to 127). The notion of an ASCII value greater than 127 is therefore meaningless. (Although the ASCII character set is a subset of several other modern character sets with 256 or more characters).
Beyond that, it depends on what you are allowed to assume about your compiler and host system.
If you are permitted to assume your compiler (and/or host system) uses the ASCII character (or a character set that is a superset of the ASCII character set) the solution is trivial.
where invalid_value is a value of type int that is outside the range [0, 127]. Note this approach may trigger compiler warnings if your compiler supports 8-bit characters (an unsigned 8-bit char type is always non-negative, and a signed 8-bit char type always has value less than or equal to 127). I'll leave eliminating such warnings, while ensuring the code still works regardless of whether char is signed or unsigned, as an exercise. Simply loop over each character in a string.
ascii_value_of_achar = (achar >= 0 && achar <= 127) ? ((int)achar) : (invalid_value);
If your compiler/host supports another character set (eg a EBCDIC variant) then you'll need to get your hands on a published translation table, and implement a lookup table of some form.