Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Pokedex_Assignment
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
a-j.towse
Pokedex_Assignment
Commits
21a92d6c
Commit
21a92d6c
authored
Jan 03, 2023
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed printPokiList function - all commented
parent
5fd507f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
main
main
+0
-0
main.c
main.c
+6
-4
No files found.
main
View file @
21a92d6c
No preview for this file type
main.c
View file @
21a92d6c
...
@@ -83,7 +83,6 @@ void AddPokemonToList(struct Pokedex pokedex,char name[], char type[], char abil
...
@@ -83,7 +83,6 @@ void AddPokemonToList(struct Pokedex pokedex,char name[], char type[], char abil
//If the list is empty, point head to new node
//If the list is empty, point head to new node
if
(
temp
==
NULL
)
{
if
(
temp
==
NULL
)
{
*
ptrHead
=
newNode
;
//Point the head to the new node
*
ptrHead
=
newNode
;
//Point the head to the new node
newNode
->
prev
=
NULL
;
//Set the new node prev to NULL
newNode
->
next
=
NULL
;
//Set the new node next to NULL
newNode
->
next
=
NULL
;
//Set the new node next to NULL
return
;
return
;
}
}
...
@@ -92,8 +91,10 @@ void AddPokemonToList(struct Pokedex pokedex,char name[], char type[], char abil
...
@@ -92,8 +91,10 @@ void AddPokemonToList(struct Pokedex pokedex,char name[], char type[], char abil
return
;
return
;
}
}
temp
->
next
=
newNode
;
//Set the next pointer of the old last node to new node
*
ptrHead
=
newNode
;
//Set pointer to head to point to newNode
newNode
->
prev
=
temp
;
//Set the prev pointer of the new node to the old last node
newNode
->
next
=
temp
;
//Set newNode to point to old first item in list
newNode
->
prev
=
NULL
;
//Set the prev pointer to NULL as is first item in list
temp
->
prev
=
newNode
;
//Set temp to point to new first item in list (newNode)
}
}
}
}
...
@@ -145,6 +146,8 @@ int main (void) {
...
@@ -145,6 +146,8 @@ int main (void) {
AddPokemonToList
(
pokedex
,
"Squirtle"
,
"Water"
,
"WaterBlast"
);
AddPokemonToList
(
pokedex
,
"Squirtle"
,
"Water"
,
"WaterBlast"
);
AddPokemonToList
(
pokedex
,
"Squirtle"
,
"Water"
,
"WaterBlast"
);
//Testing that it doesnt add a duplicate
AddPokemonToList
(
pokedex
,
"Squirtle"
,
"Water"
,
"WaterBlast"
);
//Testing that it doesnt add a duplicate
AddPokemonToList
(
pokedex
,
"The grass one"
,
"Leaf"
,
"LeafSomething"
);
AddPokemonToList
(
pokedex
,
"The grass one"
,
"Leaf"
,
"LeafSomething"
);
AddPokemonToList
(
pokedex
,
"Poki1"
,
"Leaf"
,
"LeafSomething"
);
AddPokemonToList
(
pokedex
,
"Poki2"
,
"Leaf"
,
"LeafSomething"
);
printf
(
"%p
\n
"
,
FindPokemon
(
pokedex
,
"Charmander"
));
printf
(
"%p
\n
"
,
FindPokemon
(
pokedex
,
"Charmander"
));
...
@@ -152,4 +155,3 @@ int main (void) {
...
@@ -152,4 +155,3 @@ int main (void) {
return
0
;
return
0
;
}
}
//List node not listing squirtle for some reason... fix me
\ No newline at end of file
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