易截截图软件、单文件、免安装、纯绿色、仅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 ......

这个是什么意思,unsigned int c:2, d:1;

struct s1 {
char ch, *ptr;
union {
short a, b;
unsigned int c:2, d:1;
}
struct s1 *next;
};


主要看不懂符号 :

请达人指点一二
http://blog.cechina.cn/true ......

关于字符串的C面试题

给一个字符串、例如 “ababc”要求返回“ab”. 因为“ab”连续重复出现且最长。  用C/C++语言写一函数完成该算法,给出复杂度
这个题我不会

C/C++ code:

#include <iostream>
#include <s ......

一个简单计算器c代码

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

float date1,date2;
char op;

void ......

两个C文件的问题

以前在VC里面建一个工程,都只用一个 .c 文件,昨天在一个工程里用了两个 .c文件了,遇到问题了,请大家指点。比如:
File1.c Fil ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号