C 语言实例 – 输出单个字符

C 语言实例 - 输出单个字符

使用 printf() 与 %c 格式化输出一个字符。

#include <stdio.h>
 
int main() {
   char c;        // 声明 char 变量
 
   c = 'A';       // 定义 char 变量
 
   printf("c 的值为 %c", c);
 
   return 0;
}

 文章源自公式库网-https://www.gongshiku.com/html/202112/c-yuyanshili-shuchudangezifu.html

输出结果:文章源自公式库网-https://www.gongshiku.com/html/202112/c-yuyanshili-shuchudangezifu.html

c 的值为 A

 文章源自公式库网-https://www.gongshiku.com/html/202112/c-yuyanshili-shuchudangezifu.html

文章源自公式库网-https://www.gongshiku.com/html/202112/c-yuyanshili-shuchudangezifu.html文章源自公式库网-https://www.gongshiku.com/html/202112/c-yuyanshili-shuchudangezifu.html
运营不易,
感谢支持!
weinxin
我的微信
微信号已复制
我的微信公众号
我的微信公众号扫一扫
weinxin
我的公众号
公众号已复制
 最后更新:2021-12-7
公式库网
  • 本文由 公式库网 发表于2021年12月4日 21:51:28
  • 转载请务必保留本文链接:https://www.gongshiku.com/html/202112/c-yuyanshili-shuchudangezifu.html

发表评论