自己用C写的一个链表,老是有错,高手请进!
自己用C语言在VC6.0编译器中写的一个链表程序。三个文件如下:
LList.h:链表的头文件。
C/C++ code:
//用C语言定义的包含int元素的单链表,实现了增删改查功能。
#include <stdio.h>
#ifndef LLIST_H
#define LLIST_H
#ifdef __cplusplus
extern "C" {
#endif
enum bool
{
false,
true
};
typedef struct Node
{
int element;
struct Node *next;
}Node;
typedef struct
{
struct Node *head;
struct Node *tail;
int count;
}LList;
/*
添加一个节点到链表中,成功返回true,失败返回false*/
enum bool add(LList *listPtr, int num);
/*
删除一个含有特定值的接点重链表中*/
enum bool del(LList *listPtr, int num);
/*
修改含有一个特定的植的节点*/
enum bool modify(LList *listPtr,int oldNum,int newNum);
/*
查找一个含有特定值的接点,找到并返回接点的地址*/
Node* find(LList *listPtr,int num);
/*
初始化一个链表*/
enum bool initial(LList *listPtr);
/*
打印链表中的所有元素*/
void printList(LList *listPtr);
#ifdef __cplusplus
}
#endif
#endif
LList.c文件,链表的.c文件:
C/C++ code:
#include "LList.h"
#include <stdio.h>
#include <stdlib.h>
enum bool
相关问答:
#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 ......
#include <stdio.h>
#include <graphics.h>
void main()
{
int x0,y0,x1,y1,driver,mode,i;
driver=VGA;
mode=VGAHI;
initgraph(&driver,&mode,&qu ......
函数是 用listdelete()返回e 如果type *e不加NULL 则提示先使用 加了后为什么在结果后还有一个NULL pointer assignment 怎么让它不警告 结果也不显示NULL pointer assignment?
void main(){
......
我在程序中用CreatePipe创建了一个管道,用它和命令行cmd.exe来关联。
现在我WriteFile来向管道写入 ping 192.168.0.1 -t 来启动ping测试,请问我如何停止这个ping? 我想向管道内写
Ctrl+C来实现,但 ......