C examples for Data Type:char
Use getchar() and putchar() to input characters from the keyboard and display them in reverse case.
#include <stdio.h> #include <ctype.h> int main(void) { char ch;//w ww . j a v a 2 s .c o m printf("Enter some text (type a period to quit).\n"); do { ch = getchar(); if (islower(ch)) ch = toupper(ch); else ch = tolower(ch); putchar(ch); } while (ch != '.'); return 0; }