Skip to content

Commit 2defdc1

Browse files
committed
Add a Todo
1 parent 702279f commit 2defdc1

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

c/link_table/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PROJECT(LINK_TABLE)
2+
CMAKE_MINIMUM_REQUIRED(VERSION 2.9)
3+
INCLUDE_DIRECTORIES(./include)
4+
AUX_SOURCE_DIRECTORY(./src DIR_SRC)
5+
ADD_EXECUTABLE(./bin ${DIR_SRC})

c/link_table/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mkdir build
2+
cd build
3+
cmake ..
4+
make

c/link_table/include/head.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>

c/link_table/src/main.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "../include/head.h"
2+
int main(){
3+
struct body_link {
4+
void *data;
5+
int type;
6+
struct body_link *next;
7+
};
8+
struct head_link {
9+
char *name;
10+
struct body_link *head;
11+
struct body_link **location;
12+
int offset;
13+
struct head_link *next;
14+
};
15+
return 0;
16+
}
17+
18+
(struct head_link*)hcreate(){
19+
struct head_link *temp;
20+
temp = (struct head_link*)(malloc(sizeof(struct head_link)));
21+
temp->head = (struct body_link*)(malloc(sizeof(struct body_link)));
22+
temp->location = &(temp->head);
23+
temp->offset = 0;
24+
return temp;
25+
}
26+
int hadd(struct head_link *head_hl){
27+
struct head_link *temp;
28+
temp = (struct head_link*)(malloc(sizeof(struct head_link)));
29+
head_hl->next = temp;
30+
temp->head = head_hl->head;
31+
temp->location = (struct body_link*)(malloc(sizeof(struct body_link)));
32+
temp->offset = (head_hl->offset+1);
33+
return 0;
34+
}

0 commit comments

Comments
 (0)