#include <iostream>using namespace std;
//链表
typedef struct mystruct 
{
int x;
mystruct* next; 
//mynode* next; 
} mynode;//排序函数
//mystruct * linksort(mystruct * nod1,mystruct * nod2 );
mynode * linksort(mynode * nod1,mynode * nod2 );
void main(void)
{
//生成链表
mynode *p1=(mynode *)malloc(sizeof(mynode));
p1->x=0;
mynode *p2=(mynode *)malloc(sizeof(mynode));
p2->x=0;
mynode *temp1=NULL;
mynode *temp2=NULL;
temp1=p1;
temp2=p2;
for (int i=1;i<5;i++)
{

temp1->next=(mynode *)malloc(sizeof(mynode));
temp1=temp1->next;
temp1->x=2+i;
temp1->next=NULL; temp2->next=(mynode *)malloc(sizeof(mynode));
temp2=temp2->next;
temp2->x=4+i;
temp2->next=NULL; }
temp1=p1;
for (i=0;i<5;i++)
{
cout<<temp1->x<<"  ";
temp1=temp1->next;
}
cout<<endl;
temp2=p2;
for (i=0;i<5;i++)
{
cout<<temp2->x<<"  ";
temp2=temp2->next;
}
cout<<endl;
//排序函数
p1=linksort(p1,p2); //如果写成mystruct (* linksort)(p1,p2);这就变成一个函数指针了。指向函数的指针,返回int型数据
}