warning: expression result unused

You get the warning because the expression gets calculated, and then the result is dropped. This is related to the “reaching the end of the function without returning a value” error: adding return in front of the expression will fix both:

char change(const char c) {
    return (c >= 'A') && (c <= 'M') ? 
        (c+'N'-'A') :  ((c >= 'N') && (c <= 'Z') ? 
             (c-('N'-'A')) : ((c >='a') && (c <= 'm') ? 
                 (c+'n'-'a') : ((c >= 'n') && (c <= 'z') ? 
                     (c-('n'-'a')) : c )));
}

Leave a Comment