U-2, C-1 (Input and Output)
U-2, C-1 (Input and Output)
◼ Step 7: Stop
Managing Input and
Output Operations
Agenda
◼ Reading a Character
◼ Writing a Character
◼ Formatted Input
◼ Formatted Output
Reading a Character
◼ To read a single character from the
standard input device, getchar function
can be used.
var_name= getchar();
◼ Example:
char ch;
ch=getchar();
◼ getchar() can be used inside a loop with
proper terminating condition, to accept
multiple characters.
◼ Functions related to characters are
isalnum(c) - Is ‘c’ an alphanumeric
character?
isalpha(c) - alphabet
isdigit(c) - digit
islower(c) - lower case letter
isprint(c) - printable character
ispunct(c) - punctuation mark
isspace(c) - white space
isupper(c) - upper case letter