c语言数组输入char
发布时间: 2022-12-22 21:18:19
‘壹’ c语言char型输入输出问题
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main(void)
{
int a, b, c;
char x, y, z;
scanf("%d%d%d", &a, &b, &c);
printf("%d%d%d\n", a, b, c);
scanf("\n%c%c%c", &x, &y, &z);////这样之后看看,,,,,因为在输入流中"\n"被按照字符读入了。
printf("%c %c %c\n", x, y, z);
getch();
return 0;
}
‘贰’ C语言中char的用法
#include<stdio。h>
intmain()
{
inti;
charc;//定义一个char类型的变量。
c='a';//赋值
for(i=0;i<26;i++){
printf(“%c”,c);//输出一个字符用%c,
c++;//charc增加1,依次可以得到:abcdef。。。。z
}
printf(“ ”);
if(c<='z')
printf(“stillasmallletter。 ”);
else
printf(“Notasmallletter。 ”);
scanf(“%c”,&c);//输入一个字符到c中。
charstr[10]=“AString”;//定义一个字符数组,它的初值是“AString”
for(i=0;str[i]!='