[求助]为什么输出 错误?
#include"stdio.h"#include"string.h"
main()
{
int c[100],i,n;
scanf("%d",c);
n=strlen(c);
for(i=0;i<n;i++)
printf("%d",c[i]);
getch();
}
为什么 输入123 就输出正确 输出1234 就输出大串 数字呢?
只能对字符串整体输入.
用"%s"可以对一个字符串进行整体的输入输出.
如:
# include <stdio.h>
void main()
{
char c[10];
scanf("%s",c);
printf("%s",c);
}