/* Demonstrate a couple of the character functions. Note that if you * want to read in a letter and you also hit Enter, you need 2 (not 1!) * getchar() functions. putchar can accept variables, characters, or * ascii codes. */ // Preprocessor Directives #include #include // Main Function int main(void) { // Define Variables char c, d; // Read in a character and the New Line char. printf("Enter a character: "); c=getchar(); d=getchar(); // Print them to the screen printf("The characters are: "); putchar(c); putchar(d); // Print out an A and New Line char printf("You can print characters: "); putchar('A'); putchar('\n'); // Print out an A and New Line char using ascii codes printf("Or you can print ASCII codes: "); putchar(65); putchar(10); // End main function return(0); }