一、以下程序包含三个函数:sort,print,printfil,按照要求完成

来源:百度知道 编辑:UC知道 时间:2024/07/04 02:32:13
一、以下程序包含三个函数:sort,print,printfil,按照要求完成题目

#include <stdio.h>
#define NULL 0
#define LEN sizeof (struct student);
struct student
{ long num;
struct student *next;
};
int n;

struct student *creat(int *p ,int i) /*素数作为节点的num,生成链表*/
{

return(head);
}
print (struct student *head)
{struct student *p;
p = head;
if (head != "NULL")
do
{printf ("%ld\n", p->num)
p = p->next;
}while (p != "NULL");
}

}
main( )
{struct student *head;
int a[100],i,j;
for(i=1;i<=100;i++)/*对1-100的数i,如果是素数a[i]置1,否则为0*/
if (check(i)) a[i]=1;
else
a[i]=0;
head=creat(a,100) /*生成链表,数组名和容量作为参数*/
print(a,100);
}

{printf ("%ld\n", p->num)
p = p->next;
}while (p != "NULL");
}

}
main( )
{struct student *head;
int a[100],i,j;
for(i=1;i<=100;i++)/*对1-100的数i,如果是素数a[i]置1,否则为0*/
if (check(i)) a[i]=1;
else
a[i]=0;
head=creat(a,100) /*生成链表,数组名和容量作为参数*/
print(a,100);
}