引用指针输出字符串问题
#include<stdio.h>#define BUFFER_LEN 100
void main()
{
char buffer[BUFFER_LEN];
char *ps1=NULL;
char *pbuffer=buffer;
printf("\nenter a message\n");
ps1=pbuffer;
while((*pbuffer++=getchar())!='\n');
printf("\nthe strings you entered are :\n\n%s",ps1);
}
不知道为什么,输出字符串后面还有一堆汉字乱码。求解