c语言字符串类型如何输出


在C语言中,字符串类型是使用字符数组来表示的。可以使用printf函数来输出字符串类型的变量,也可以使用puts函数来输出字符串类型的变量。下面是两种输出字符串类型的方法示例:

    使用printf函数输出字符串类型的变量:
#include <stdio.h>int main() {char str[] = "Hello, world!";printf("%s\n", str);return 0;}

输出结果为:

Hello, world!
    使用puts函数输出字符串类型的变量:
#include <stdio.h>int main() {char str[] = "Hello, world!";puts(str);return 0;}

输出结果为:

Hello, world!


上一篇:java中convert的应用场景有哪些

下一篇:session在jsp中不显示怎么解决


c语言
Copyright © 2002-2019 测速网 https://www.inhv.cn/ 皖ICP备2023010105号 城市 地区 街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!
热门搜索