cs240/hw/hw1/hw1-final/getchar.c
2018-10-15 17:20:57 -04:00

20 lines
481 B
C
Executable File

#include <stdio.h>
int main(){
char c;
printf("Enter a character:");
/*Grab the next character from stdin and store it in variable c, remember to account for the newline character*/
c = getchar();
getchar(); /* Consume the newline. */
printf("The character you entered was %c\n", c);
printf("Enter a second character:");
/*Grab the next character from stdin and store it in c again*/
c = getchar();
printf("The character you entered was %c\n", c);
return 0;
}