Dotcpp  >  编程教程  >  stdio.h头文件  >  C语言putchar()函数:在stdout上输出字符

C语言putchar()函数:在stdout上输出字符

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

函数名: putchar

头文件:<stdio.h>

函数原型: int putchar(int ch);

功 能: 在stdout上输出字符

参数: int ch  为被写入的字符,该字符以其对应的 int 值进行传递  

返回值:成功   以无符号 char 强制转换为 int 的形式返回写入的字符 ,失败   返回 EOF。


程序例: 输出字符串www.dotcpp.com

#include<stdio.h>

int main(void){

   putchar('w'); 

   putchar('w');

   putchar('w');

   putchar('.');

   putchar('d');

   putchar('o');

   putchar('t');

   putchar('c');

   putchar('p');

   putchar('p');

   putchar('.');

   putchar('c');

   putchar('o');

   putchar('m');

   putchar('\n');

   return 0;

}

 

运行结果

www.dotcpp.com



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

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在线编译      (登录可减少运行等待时间)