程序输出结果后面跟有乱码
#include <stdlib.h>#include <stdio.h>
struct friend_type
{
char name[20];
char sex;
long num;
int age;
char add[100];
};
void main ()
{
struct friend_type student[2],*p;
int i;
for (i=0,p=student;i<2;p++,i++)
{
printf("enter the information of student[%d]:\n",i);
scanf ("%s, %c, %ld, %d, %s",p->name,&p->sex,&p->num,&p->age,p->add);
}
for (i=0,p=student;p<student+2;p++,i++)
{
printf("%3d, %-20s, %3c, %8ld, %20s, %6d\n",i,p->name,p->sex,p->num,p->add,p->age);
}
system("pause");
}
程序输出结果后跟有乱码,求大神指教