为什么第一个函数的fou循环只能输入一次值


// 第七次作业第三题vs.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include"malloc.h"
#define LEN sizeof(struct student)
struct student
{int num;char name[10];struct student*next;
};

struct student* create(struct student *p1,struct student*p2,int n)
{
    int i;
    struct student *head;
    head=p1;
    for(i=0;iscanf_s("%d%s",&p1->num,&p1->name);
     fflush(stdin);
     if(i==(n-1))
     {p1->next=NULL;}
     else
     {     p1=(struct student*)malloc(LEN);
      }  p2->next=p1;
    }
    return (head);
}

void f(struct student *head)
{
    
    struct student *p1,*p2;
    int i=0;
    p1=head;
    while(p1->next!=NULL)
    {p2=p1;
    p1=p1->next;
    i++;
    }
    i++;
    printf("主函数的个数为:%d\n",i);
}

struct student* fv(struct student *head)
{
    struct student *p1,*p2,*p3,*head2;
    p1=head;p2=head;p3=head;
    while(p1!=NULL)
    {
        if(p1==p2)
        {p1=p1->next;
        p2->next=NULL;
        p2=p1;
        p3=p1;
        p3->next=head;
        p1=p1->next;
        }
        else
        {
            p2=p1;
            p1=p1->next;
            p2->next=p3;
        }
    }
    head2=p2;
    return head2;
}

void list(struct student*head)
{
    struct student *p;
    p=head;
    while(p!=NULL)
    {
        printf("学号/名字:%s  %s\n",p->num,p->name);
        p=p->next;
    }

}

void search(int m,struct  student* head)
{
    struct student *p;
    p=head;
    while(p!=NULL)
    {
        if(p->num==m)
            printf("\n学生学号/名字为:%d   %s",p->num,p->name);
        else p=p->next;
    }
    if(p==NULL)
    {printf("\n查无此人");}
}

int _tmain(int argc, _TCHAR* argv[])
{
    struct student *p1,*head,*p2,*head2;
        p1=(struct student*)malloc(LEN);
        p2=p1;
    int n,m;
    printf("请输入学生总人数:");
    scanf_s("%d",&n);
    fflush(stdin);
    head=create(p1,p2,n);
    list(head);
    f(head);
    head2=fv(head);
    list(head2);
    printf("请输入要检索的学生的学号:");
    scanf_s("%d",&m);
    search(m,head2);
    return 0;
}


scanf_s("%d%s",&p1->num,p1->name);
字符串不用加&