/* Exercise 2-10. Rewrite the function lower, which converts upper case letters to lower case,
with a conditional expression instead of if-else. */
#include <stdio.h>
int tolower(int ch);
int main(void)
{
char ch='c';
printf("%c\n",tolower(ch));
return 0;
}
int tolower(int ch)
{
return (ch>='A' && ch<='Z')?(ch+'a'-'A'):ch;
}
K & R C 2nd Edition Exercise 2-10
最新推荐文章于 2020-05-14 15:16:39 发布