C语言 链表的有关问题··求解释

C语言 链表的问题··求解释
#include"stdlib.h"
#include"stdio.h"
#include <string.h>

typedef struct jcb
{
char name[4];
int leng; 
int printer;
int tape;
int runtime;
int waittime;
struct jcb *next;
} JCB;

JCB *head;//全局变量 
int tape, printer;
long memory;
void shedule()
{
float xk,k;
JCB *p,*q,*s,*t;
do
{
p=head;
s=NULL;
q=NULL;
k=0;
while(p!=NULL)
{
if(p->leng<=memory && p->tape <=tape && p->printer<=printer)
{
xk=(float)(p->waittime)/p->runtime;
if(q==NULL || xk>k)
{
k=xk;
q=p;
t=s;
}//找链表里面最大响应比 (Xk)转递给q;t s 的作用是什么??··
}
s=p;
p=p->next;
}
if(q!=NULL)
{
if(t==NULL)
head=head->next;//这里是在链表头就是最大的情况 对吧?!
else
t->next=q->next;//这句话什么意思·??
memory=memory-q->leng;
tape=tape-q->tape;
printer=printer-q->printer;
printf("job selected!! %s \n",q->name);
}
}while(q!=NULL);


}

int main() //mian函数 还是知道什么意思的·····
{
int i;
char name[4];
int size,tcount,pcount,wtime,rtime;
JCB *p;
memory=65536;
tape=4;
printer=2;
head=NULL;
printf("输入 作业名字,大小,磁带数,打印机,等待时间,估计运行时间\n");
// q1 5 2 1 2 2
// q3 8 1 1 3 1
// q2 6 1 0 2 1
  // q4 -1 -1 -1 -1 0 //这里是作业
scanf("%s%d%d%d%d%d",name,&size,&tcount,&pcount,&wtime,&rtime);
while(size!=-1)
{
p=(JCB*)malloc(sizeof(JCB));
strcpy(p->name,name);
p->leng=size;
p->tape=tcount;
p->printer=pcount;
p->waittime=wtime;
p->runtime=rtime;
p->next=head;
head=p;
printf("输入 作业名字,大小,磁带数,打印机,等待时间,估计运行时间\n");
scanf("%s%d%d%d%d%d",name,&size,&tcount,&pcount,&wtime,&rtime);
}
shedule();
return 1;
}
-------------------------------------

------解决方案--------------------
探讨
#include"stdlib.h"
#include"stdio.h"
#include <string.h>

typedef struct jcb
{
char name[4];
int leng;
int printer;
int tape;
int runtime;
int waittime;
struct jcb *next;
} JCB;

JCB *……