fork download
  1. /*
  2.  * hello.c
  3.  *
  4.  * print "Hello World!" on standard output device (console).
  5.  *
  6.  */
  7.  
  8. #include <stdio.h>
  9.  
  10. void toUpperCase(char *p);
  11. void toLowerCase(char *p);
  12.  
  13. int main()
  14. {
  15. char mes1[] = "Hello";
  16. char mes2[] = "World!";
  17.  
  18. toUpperCase(mes1);
  19. toLowerCase(mes2);
  20.  
  21. printf("%s %s\n", mes1, mes2);
  22.  
  23. return 0;
  24. }
  25.  
  26. void toUpperCase(char *p)
  27. {
  28. for ( ; *p != '\0'; p++) {
  29. if (('a' <= *p) && (*p <= 'z')) {
  30. *p += 'A' - 'a';
  31. }
  32. }
  33. }
  34.  
  35. void toLowerCase(char *p)
  36. {
  37. for ( ; *p != '\0'; p++) {
  38. if (('A' <= *p) && (*p <= 'Z')) {
  39. *p += 'a' - 'A';
  40. }
  41. }
  42. }
  43.  
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
HELLO world!