C语言编了一个表为什么数据输入了以后有一些输出是乱码?
#include<string.h>#include<stdio.h>
#include<malloc.h>
#define MAXSIZE 100
#define LIST_INIT_SIZE 100
typedef struct workers
{ char name[15];//姓名
char department[18];//单位
char gender;//性别
unsigned int age;//年龄
unsigned long telephone;//电话
unsigned long wage;//工资
unsigned long num;//职工号
struct workers *next;
}DataType;
typedef struct
{
DataType wok[MAXSIZE];
int length;
}sequenlist;
void CreateList (sequenlist *L)
{
int i,n;
printf("请输入员工数量");
fflush(stdin);
scanf("%d",&n);
printf("请输入这%d位员工的信息\n",n);
printf("----------------------------------------\n");
for(i=1;i<=n;i++)
{ printf("第%d个职工:",i);
printf("\n姓名 单位 性别 年龄 电话 工资 职工号 \n");
scanf("%s%s%c%u%lu%lu%lu",&L->wok[i].name,&L->wok[i].department,&L->wok[i].gender,&L->wok[i].age,&L->wok[i].telephone,&L->wok[i].wage,&L->wok[i].num);
printf("***************************************\n");
printf("%s,%s,%c,%u,%lu,%lu,%lu",L->wok[i].name,L->wok[i].department,L->wok[i].gender,L->wok[i].age,L->wok[i].telephone,L->wok[i].wage,L->wok[i].num);
}
L->length=n;
}// 表的建立
int main ()
{
sequenlist *L;
DataType *workers;
int i;
L=(sequenlist*)malloc(LIST_INIT_SIZE*sizeof(sequenlist));
CreateList (L);
getch ();
return 0;
}