博客
关于我
输入输出I/O(二)
阅读量:605 次
发布时间:2019-03-12

本文共 584 字,大约阅读时间需要 1 分钟。

今天和大家继续分享关于C语言函数库的知识,特别是常用的字符串输出函数。

  • printf函数
  • printf("格式字符串", 输出项1, 输出项2, ...) 这是最常用的格式化输出函数。格式字符串中使用%符号控制输出类型。例如:

    #include 
    int main() { int i = 10; printf("i=%d\n", i); return 0;}
    1. puts函数
    2. puts()函数用于输出字符串。直接将字符串传递给函数即可。例如:

      #include 
      int main() { char a[] = "I love you!"; puts(a); return 0;}
      1. putchar函数
      2. putchar()函数用于输出单个字符,适合逐个处理大字符串中的字符。例如:

        #include 
        int main() { char a[] = "I love you!"; int i = 0; for (; i < 12; i++) { putchar(a[i]); } return 0;}

        这些函数是C语言中处理字符串输出的常用工具,熟练掌握它们能显著提高开发效率。如果需要更深入的学习,欢迎继续关注我们。

    转载地址:http://xjpxz.baihongyu.com/

    你可能感兴趣的文章
    npm安装教程
    查看>>
    npm报错Cannot find module ‘webpack‘ Require stack
    查看>>
    npm报错Failed at the node-sass@4.14.1 postinstall script
    查看>>
    npm报错fatal: Could not read from remote repository
    查看>>
    npm报错File to import not found or unreadable: @/assets/styles/global.scss.
    查看>>
    npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
    查看>>
    npm版本过高问题
    查看>>
    npm的“--force“和“--legacy-peer-deps“参数
    查看>>
    npm的安装和更新---npm工作笔记002
    查看>>
    npm的常用配置项---npm工作笔记004
    查看>>
    npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
    查看>>
    npm编译报错You may need an additional loader to handle the result of these loaders
    查看>>
    npm设置淘宝镜像、升级等
    查看>>
    npm设置源地址,npm官方地址
    查看>>
    npm配置安装最新淘宝镜像,旧镜像会errror
    查看>>
    NPM酷库052:sax,按流解析XML
    查看>>
    npm错误 gyp错误 vs版本不对 msvs_version不兼容
    查看>>
    npm错误Error: Cannot find module ‘postcss-loader‘
    查看>>
    npm,yarn,cnpm 的区别
    查看>>
    NPOI之Excel——合并单元格、设置样式、输入公式
    查看>>