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
d8f7825d
Commit
d8f7825d
authored
Sep 19, 2020
by
Liam E. Roeth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some functions to test
parent
4f7b3269
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
test.c
test.c
+16
-6
No files found.
test.c
View file @
d8f7825d
...
...
@@ -3,19 +3,29 @@
#include "llist.h"
int
main
(){
puts
(
"Constructing list manually..."
);
NODE
*
two
=
construct
(
5
,
NULL
);
NODE
*
one
=
construct
(
1
,
two
);
NODE
*
root
=
construct
(
3
,
one
);
print_list
(
root
);
printf
(
"Searching for 5...
\n
"
);
puts
(
"Adding 7 to end..."
);
add_to_end
(
root
,
7
);
print_list
(
root
);
printf
(
"Now it is %d elements long.
\n
"
,
length
(
root
));
printf
(
"The head is at %p.
\n
"
,
root
);
puts
(
"Adding 6 to the beginning and 8 at index 2..."
);
insert_node
(
root
,
0
,
6
);
insert_node
(
root
,
2
,
8
);
print_list
(
root
);
printf
(
"The head is still at %p.
\n
"
,
root
);
puts
(
"Searching for 5..."
);
NODE_ERR
target
=
search
(
root
,
5
);
printf
(
"I found it at index %d
\n
"
,
target
.
err
);
printf
(
"The number I found there was "
);
printf
(
"I found it at index %d
.
\n
"
,
target
.
err
);
fputs
(
"The number I found there was: "
,
stdout
);
print_node
(
target
.
node
);
p
rintf
(
"Deleting list...
\n
"
);
p
uts
(
"Deleting list...
"
);
delete_list
(
root
);
p
rintf
(
"Now it is garbage:
\n
"
);
p
uts
(
"Now it is garbage:
"
);
print_list
(
root
);
return
0
;
...
...
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