问题描述:

Is there any doc i can read about this kind of function?

// return the capital of char c

char a(char c){

return c >= 'a' && c<='z' ?

c +'A' - 'a':c;

}

网友答案:

Read up on the ternary operator. :) And then it will be clear the code is doing:

if (c >= 'a' && c<='z') {
   return(c +'A' - 'a');
} else {
    return c;
}

So basically it is capitalizing the Latin alphabet in ASCII.

相关阅读:
Top