该代码实现了tree的结构,依赖dyArray数据结构。有first一级目录,second二级目录。
dyArray的c实现参考这里点击打开链接 hashTable的c实现参考这里点击打开链接
下面是跨平台的数据类型定义
//
// cpPlatform.h
// dataStruct
//
// Created by hherima on 14-7-29.
// Copyright (c) 2014年 . All rights reserved.
//
#ifndef dataStruct_cpPlatform_h
#define dataStruct_cpPlatform_h
enum
{
CP_FALSE = 0,
CP_TRUE = !CP_FALSE
};
#define F_MALLOC_TYPE(s) (s*)f_malloc(sizeof(s))
#define FREEFUN free
#define MIN_PRE_ALLOCATE_SIZE 10 //The initial size of the dynamic array.
#define MEMSETFUN memset
#define REALLOCFUN realloc
#define MALLOCFUN malloc
#define MEMCMPFUN memcmp
#define MEMCPYFUN memcpy
typedef unsigned char cp_bool;
typedef signed int cp_int32;
typedef char cp_int8;
typedef unsigned int cp_uint32;
#endif
//
// treeStruct.h
// dataStruct
//
// Created by hherima on 14-8-1.
// Copyright (c) 2014年 . All rights reserved.
//
#ifndef dataStruct_treeStruct_h
#define dataStruct_treeStruct_h
#include <stdlib.h>
#include "cpPlatform.h"
#include "dyArray.h"
struct firstnode;
struct secondnode;
struct tree;
enum nodetype //tree节点类型
{
second_type_node,
first_type_node
};
struct f