Dotcpp  >  编程教程  >  stdio.h头文件  >  C语言getche()函数:从控制台取字符

C语言getche()函数:从控制台取字符

点击打开在线编译器,边学边练

函数名: getche

头文件:<stdio.h>

函数原型: int getche(void);

功 能: 从控制台取字符(带回显),不以回车为结束;

参 数: 没有参数

返回值: 函数返回输入的字符


程序例: 从控制台中获取一个字符,并显示出来

#include<stdio.h>

int main(void) {

   printf("Input a character:");

   char ch = getche();

   printf("\nYou input a '%c'\n", ch);

   return 0;

}

 

运行结果

Input a character:d
You input a 'd'



本文固定URL:https://www.dotcpp.com/course/520

C语言函数库
assert.h头文件
ctype.h头文件
float.h头文件
io.h头文件
math.h头文件
mem.h头文件
setjmp.h头文件
stdio.h头文件
stdlib.h头文件
sigal.h头文件
string.h头文件
time.h头文件
Dotcpp在线编译      (登录可减少运行等待时间)