我自己编的从键盘随机输入无数个字符在输出的程序为什么没结果
我想从键盘随机输入无数个字符然后在输出,所以编了下面的程序,请问为什么没结果?求指点!谢谢了!#include<stdio.h>
void main()
{
char *a=NULL;
scanf("%s",a);
while(*a!=NULL)
{
printf("%c",*a++);
}
}
2014-11-02 21:41
2014-11-02 21:59
2014-11-02 23:01
程序代码:#include<stdio.h>
#include<stdlib.h>
int main()
{
char a[100];
int i=0;
gets(a);
while(a[i]!='\0')
{
printf("%c",a[i++]);
}
system("Pause");
return 0;
}
2014-11-03 14:58
2014-11-04 19:31