Use SHRT_MAX instead of MAXSHORT.