#include"stdio.h"
#include"stdlib.h"
typedef struct Node
{
 int data;
 struct Node *next;
}LIST;
LIST *Creat_List(LIST *h)
{
 LIST *p,*s;
 int data;
 p=h=(LIST *)malloc(sizeof(LIST));
 p->next=NULL;
 p->data=0;
 printf("Please enter some numbers(end with(-1)) :");
 while(1)
 {
  scanf("%d",&data);
  if(data==-1)
   break;
  s=(LIST*)malloc(sizeof(LIST));
  s->data=data;
  s->next=NULL;
  p->next=s;
  p=s;//继续循环
 }
 return h;
}
void Del_Location_LIST(LIST *h,int i)
{
 LIST *p,*t,*q;
 p=h;
 q=p->next;
 int j=1;
 while(q!=NULL&&j<i)
 {
  p=q;
  q=q->next;
  j++;
 }
  if(q==NULL)
  {
   printf("i is too big or 0\n");
   exit(-1);
  }
  else
  {
   //t=(LIST *)malloc(sizeof(LIST));
   t=p->next;
   p->next=t->next;
   free(t);
  }
}
void Print_LIST(LIST *h)
{
 LIST *p;
 p=h->next;
 printf("the list:");
 while(p!=NULL)
 {
  printf("%3d",p->data);
  p=p->next;
 }

 printf("\n");
}
void main()
{
 LIST *s;
 int n;
 s=Creat_List(s);
 printf("enter the location:");
 scanf("%d",&n);
 Del_Location_LIST(s,n);
 Print_LIST(s);
}

如果i不符合要求的部分,花费了较长时间。。。