我想根据学号来删除信息。怎么解决
case 2:
{
int num;
NodePtr s;
printf("请输入要删除的学生学号:");
scanf("%d", &num);
s = Search(head, num);
Delete(head, s);
break;
}
---------------------------------------------------------------------------
void Delete(NodePtr head, int num)
{
NodePtr p,q;
p = head;
if (p->next == NULL) printf("------------");
else{
q = p->next;
p->next = q->next;
free(q);
}
}