typedef int elemType;
struct node{
elemType data;
node *next;
};
node *test(node *head, int length)//這裡傳入的head是鏈表的頭指針
{
node *mat = new node[length];
for(int i=0; i<length; i++)
{
mat = head;
if(!head->next)
break;
head= head->next;
mat++;
}
//上面這個for迴圈是想讓new出來的每個指標指向list裡各個node的位置
for(int i=0; i<length; i++)
{
if(i==length-1)
{
mat->next = NULL;
break;
}
mat->next =