ctype.c 309 B

12345678910111213141516171819202122232425
  1. #include <ctype.h>
  2. int islower(int c)
  3. {
  4. return c >= 'a' && c <= 'z';
  5. }
  6. int isupper(int c)
  7. {
  8. return c >= 'A' && c <= 'Z';
  9. }
  10. int tolower(int c)
  11. {
  12. if (isupper(c))
  13. return c - 'A' + 'a';
  14. return c;
  15. }
  16. int toupper(int c)
  17. {
  18. if (islower(c))
  19. return c - 'a' + 'A';
  20. return c;
  21. }