fork download
  1. #include <stdio.h>
  2. #include <limits.h>
  3.  
  4. #define MASK (0x20)
  5. char toLowerCase(char c){
  6. return c | MASK;
  7. }
  8. char toUpperCase(char c){
  9. return c & ~MASK;
  10. }
  11. void printChar(char c){
  12. int i;
  13. for(i = CHAR_BIT-1; i >= 0; --i)
  14. printf("%d%s", !!(c&(1<<i)), i==4 ? " " : i == 0 ? "\n" : "");
  15. }
  16. int main(void){
  17. printf("%c\n", toLowerCase('A'));
  18. printf("%c\n", toUpperCase('a'));
  19. printChar('A');
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.02s 1676KB
stdin
Standard input is empty
stdout
a
A
0100 0001