char change(const char c){
  (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 )));
}
Why I get "warning: expression result unused" and "error: control reaches end of non-void function [-Werror,-Wreturn-type]"?
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 )));
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With