#include<stdio.h>
int main(){
//定义字符变量并赋值。
char c1='C',c2='h',c3='i',c4='n',c5='a';
//混合运算
c1+=4;
c2+=4;
c3+=4;
c4+=4;
c5+=4;
//putchar输出
printf("putchar打出:");
putchar(c1);
putchar(c2);
putchar(c3);
putchar(c4);
putchar(c5);
putchar(10);//换行
printf("printf打出:");
printf("%c%c%c%c%c",c1,c2,c3,c4,c5);
printf("\n");//换行
return 0;
}

本文展示了一个使用C语言进行字符操作的简单示例,包括字符变量定义、字符加法运算及putchar与printf函数的使用。通过将字符变量值增加4后输出,演示了字符在ASCII表中的位置关系。
5063

被折叠的 条评论
为什么被折叠?



