C语言 puts

C语言 puts

#include <stdio.h>
int puts(const char *s);

功能:标准设备输出s字符串,在输出完成后自动输出一个'\n'。

参数:

  • s:字符串首地址

返回值:

  • 成功:非负数
  • 失败:-1

案例

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

int main(void)
{
    // puts()
    // 自带换行,空格可以输出
    // 输出字符串自带换行,遇到\0停止
    // puts("");换行操作
    char ch3[] = "heelo world";
    puts(ch3);
    puts("heelo\0 world");

    return 0;
}
puts 使用案例

 

posted @ 2020-02-27 18:56  kevin.Xiang  阅读(562)  评论(0编辑  收藏  举报