#C 语言标准库函数 puts
/*********************************************
* @brief 向标准输出写入一个字符串
* @param str 要写入的字符串
* @return 是(非负)否(EOF)成功
********************************************/
int puts(const char* str);
说明
将字符串 str
写入标准输出流 stdout
中。
参数
str
- 要写入的字符
返回值
- 成功时返回非负整数
- 失败时返回
EOF
#示例
#include <stdio.h>
int main(void)
{
puts('Hello world\n');
return 0;
}
运行结果:
Hello World
#推荐阅读
#参考标准
- C23 standard (ISO/IEC 9899:2024):
- 7.21.7.9 The puts function (p: TBD)
- C17 standard (ISO/IEC 9899:2018):
- 7.21.7.9 The puts function (p: TBD)
- C11 standard (ISO/IEC 9899:2011):
- 7.21.7.9 The puts function (p: 333)
- C99 standard (ISO/IEC 9899:1999):
- 7.19.7.10 The puts function (p: 299)
- C89/C90 standard (ISO/IEC 9899:1990):
- 7.9.7.10 The puts function