Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
linked_list2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Liam E. Roeth
linked_list2
Commits
9f539681
Commit
9f539681
authored
Sep 17, 2020
by
Liam E. Roeth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfixes
parent
5fb1e561
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
+9
-10
Makefile
Makefile
+2
-2
llist.c
llist.c
+6
-6
llist.h
llist.h
+1
-2
No files found.
Makefile
View file @
9f539681
...
@@ -4,10 +4,10 @@ test : test.out
...
@@ -4,10 +4,10 @@ test : test.out
.PHONY
:
run compile test
.PHONY
:
run compile test
test.out
:
llist.c llist.h main.c
test.out
:
llist.c llist.h main.c
gcc
-o
test.out llist.c test.c
gcc
-
std
=
c99
-
o
test.out llist.c test.c
main.out
:
llist.c llist.h main.c
main.out
:
llist.c llist.h main.c
gcc
-o
main.out llist.c main.c
gcc
-
std
=
c99
-
o
main.out llist.c main.c
compile
:
test.out main.out
compile
:
test.out main.out
...
...
llist.c
View file @
9f539681
...
@@ -22,7 +22,7 @@ void print_list(NODE *head){
...
@@ -22,7 +22,7 @@ void print_list(NODE *head){
int
i
=
0
;
int
i
=
0
;
while
(
currentNode
->
data
!=
NULL
){
while
(
currentNode
!=
NULL
){
printf
(
"Index: %d; Data: %d
\n
"
,
i
,
currentNode
->
data
);
printf
(
"Index: %d; Data: %d
\n
"
,
i
,
currentNode
->
data
);
currentNode
=
currentNode
->
next
;
currentNode
=
currentNode
->
next
;
i
++
;
i
++
;
...
@@ -30,14 +30,14 @@ void print_list(NODE *head){
...
@@ -30,14 +30,14 @@ void print_list(NODE *head){
}
}
NODE
*
search
(
int
n
,
NODE
*
head
){
NODE
*
search
(
NODE
*
head
,
int
pos
){
printf
(
"Searching list for: %d"
,
n
);
printf
(
"Searching list for: %d"
,
pos
);
NODE
*
currentNode
;
NODE
*
currentNode
;
currentNode
=
head
;
currentNode
=
head
;
while
(
currentNode
->
data
!=
NULL
){
while
(
currentNode
!=
NULL
){
if
(
currentNode
->
data
==
n
){
if
(
currentNode
->
data
==
pos
){
printf
(
"Location found, index: %d."
,
currentNode
);
printf
(
"Location found, index: %d."
,
currentNode
);
return
currentNode
;
return
currentNode
;
}
}
...
@@ -87,7 +87,7 @@ NODE *construct_list(datatype list[], int size){
...
@@ -87,7 +87,7 @@ NODE *construct_list(datatype list[], int size){
head
=
next
;
head
=
next
;
next
=
construct
(
list
[
i
],
head
);
next
=
construct
(
list
[
i
],
head
);
if
(
next
==
NULL
)
if
(
next
==
NULL
)
Delete_L
ist
(
head
);
delete_l
ist
(
head
);
}
}
return
next
;
return
next
;
}
}
...
...
llist.h
View file @
9f539681
...
@@ -14,7 +14,7 @@ typedef struct Node_Err
...
@@ -14,7 +14,7 @@ typedef struct Node_Err
void
print_node
(
NODE
*
head
,
int
pos
);
void
print_node
(
NODE
*
head
,
int
pos
);
void
print_list
(
NODE
*
head
);
void
print_list
(
NODE
*
head
);
NODE
*
search
(
int
n
,
NODE
*
head
);
NODE
*
search
(
NODE
*
head
,
datatype
data
);
NODE
*
construct
(
datatype
data
,
NODE
*
next
);
NODE
*
construct
(
datatype
data
,
NODE
*
next
);
NODE
*
traverse
(
NODE
*
head
,
int
pos
);
NODE
*
traverse
(
NODE
*
head
,
int
pos
);
int
delete_node_after
(
NODE
*
head
);
int
delete_node_after
(
NODE
*
head
);
...
@@ -22,5 +22,4 @@ NODE *construct_list(datatype list[], int size);
...
@@ -22,5 +22,4 @@ NODE *construct_list(datatype list[], int size);
int
add_to_end
(
NODE
*
head
,
datatype
new_data
);
int
add_to_end
(
NODE
*
head
,
datatype
new_data
);
int
insert_node
(
NODE
*
head
,
int
pos
,
datatype
new_data
);
int
insert_node
(
NODE
*
head
,
int
pos
,
datatype
new_data
);
int
insert_node_after
(
NODE
*
head
,
datatype
data
);
int
insert_node_after
(
NODE
*
head
,
datatype
data
);
NODE
*
search
(
NODE
*
head
,
datatype
data
);
int
length
(
NODE
*
head
);
int
length
(
NODE
*
head
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment