Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 341 Bytes

30.putchar和getchar.md

File metadata and controls

23 lines (18 loc) · 341 Bytes

putchar和getchar

  • putchar: 向屏幕输出一个字符
#include <stdio.h>
int main(){
    char ch = 'a';
    putchar(ch); // 输出a
}
  • getchar: 从键盘获得一个字符
#include <stdio.h>
int main(){
    char ch;
    ch = getchar();// 获取一个字符
    printf("ch = %c\n", ch);
}