易截截图软件、单文件、免安装、纯绿色、仅160KB

单链表问题 c高手请进

编写一个程序用链表实现:将一个升序整数数列的重复数据去掉
编好后,结果不对啊,求助c高手
#include <stdio.h>
#include <stdlib.h>
struct link
{
  int number;
  struct link *next;
};
struct link* creat()
{
struct link *p1,*p2;
struct link *head;
int n=0;
p1=p2=(struct link*)malloc(sizeof(struct link));
scanf("%d",&p2->number);
head=NULL;
while(p2->number!=0)
{
  n++;
  if(n==1)
  head=p1;
  else
  {
    p1->next=p2;
    p1=p2;
  }
  p2=(struct link *)malloc(sizeof(struct link));
  scanf("%d",&p2->number);
}
p1->next=NULL;
return head;
}
/struct link *del(struct link *head)
{
  struct link *p1,*p2;
  if(head==NULL)
    printf("link is empty!");
    p1=p2=head;
  if(p1->next==NULL)
    printf("needn't sort!");
    else
    {
        while(p1->next!=NULL)
        {
          p1->next=p2;
  if(p1->number==p2->number)
  {
&nb


相关问答:

c基础

#include <string.h>
#include <stdio.h>

void main()
{
int i;
char buf[]="abcde";
strncpy(buf,"abc",3);
for(i=0;i <5;i++)
printf(&q ......

一个简单计算器c代码

大家帮我看看这个代码,有很多问题,不知道怎么改,小弟在此谢谢了。
#include <stdio.h>
#include <conio.h>
#include <ctype.h>

float date1,date2;
char op;

void ......

两个C文件的问题

以前在VC里面建一个工程,都只用一个 .c 文件,昨天在一个工程里用了两个 .c文件了,遇到问题了,请大家指点。比如:
File1.c Fil ......

祝各位C友国庆快乐,中秋快乐

希望祖国更加繁荣昌盛

我和我的祖国
一刻也不能分割
无论我走到哪里
都流出一首赞歌
我歌唱每一座高山
我歌唱每一条河
袅袅炊烟小小村落
路上一道辙
啦~~~啦~~~
你用那你母亲的温 ......

eclipse3.5+cdt编译c有问题

编译普通的c没问题啊,但编译javah生成的就报错:
gcc -O0 -g3 -Wall -c -fmessage-length=0 -oHelloWorld.o ..\HelloWorld.c
gcc -otest.exe HelloWorld.o
d:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号