为什么这个代码只有输入英文姓名和性别才能继续执行下去中文却不行呢

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct stu
{
int chengji;
char name[10];
char xb[3];
int num;
};

struct node
{
struct stu data; //数据域
struct node* next; //指针域
};

struct node* createlist() //结构体指针
{
struct node* headnode = (struct node*)malloc(sizeof(struct node));//动态内存申请
headnode->next = NULL;//变量使用之前必须被初始化
return headnode;
}
struct nodecreatnode(struct stu data)
{
struct node
newnode = (struct node*)malloc(sizeof(struct node));
newnode->data = data;
newnode->next = NULL;
return newnode;
}
void printlist(struct node* headnode)
{
struct node* pMove = headnode->next;
printf("学号\t姓名\t性别\t成绩\t\n");
while (pMove)
{
printf("%d\t%s\t%s\t%d\t\n", pMove->data.num, pMove->data.name, pMove->data.xb, pMove->data.chengji);
pMove = pMove->next;
}
printf("\n");
}
void insert(struct node* headnode, struct stu data)
{
struct node* newnode = creatnode(data);
newnode->next = headnode->next;
headnode->next = newnode;
}
void delnode(struct node* headnode, int num)
{
struct node* posnode = headnode->next;
struct node* posnodefront = headnode;
if (posnode == NULL)
printf("您输入数据有错");
else
{
while (posnode->data.num!= num)
{
posnodefront = posnode;
posnode = posnodefront->next;
if (posnode == NULL)
printf("NOT FOUND");
}
}
posnodefront->next = posnode->next;
free(posnode);
}
int main(void)
{
struct node* list = createlist();
struct stu st;
while (1)
{
printf("学号\t姓名\t性别\t成绩\t:");
setbuf(stdin, NULL);
scanf("%d%s%s%d", &st.num, st.name, st.xb, &st.chengji);
insert(list, st);
printf("continue(Y/N)?\n");
setbuf(stdin, NULL);
int c = getchar();
if (c == 'N' || c == 'n')
{
break;
}
}
printlist(list);
system("pause");
return 0;
}

它的变量类型是字符,是不能用中文的,只能用英文和数字,除非改成字符串

img


定义字串长度可以大一点,因为中文占字节比英文要长,具体取决于何种编码方式