Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pokedex 2
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
suleman.hussain
pokedex 2
Commits
e73bb7bf
Commit
e73bb7bf
authored
Jan 23, 2023
by
suleman.hussain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
almost done
parent
c63c9b9d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
19 deletions
+11
-19
functions.c
functions.c
+4
-2
linklist.c
linklist.c
+6
-8
main
main
+0
-0
main.c
main.c
+1
-9
No files found.
functions.c
View file @
e73bb7bf
...
...
@@ -14,6 +14,7 @@ void AddPokemonToList(struct Pokedex *pokemon, char name[16], char type[12], cha
printf
(
"Your Pokemon has successfully been added to the Pokedex!
\n
"
);
}
}
void
AddPlayerToList
(
struct
Pokedex
*
player
,
char
name
[
16
])
{
struct
PlayerNode
*
current
=
(
struct
PlayerNode
*
)
player
->
player_head
;
...
...
@@ -78,6 +79,7 @@ void DisplayPokemonDetails(struct Pokedex *pokedex, char name[12]){
}
void
DisplayPlayerDetails
(
struct
Pokedex
*
pokedex
,
char
name
[
12
]){
struct
PlayerNode
*
current
=
(
struct
PlayerNode
*
)
pokedex
->
player_head
;
while
(
current
!=
NULL
){
...
...
@@ -94,6 +96,7 @@ void DisplayPlayerDetails(struct Pokedex *pokedex, char name[12]){
printf
(
"Sorry! I don't seem to have any record of that person.
\n
"
);
}
}
void
ListPokemon
(
struct
Pokedex
*
pokedex
)
...
...
@@ -119,7 +122,6 @@ void ListPokemon(struct Pokedex *pokedex)
}
}
void
ListPlayers
(
struct
Pokedex
*
pokedex
){
struct
PlayerNode
*
current
=
(
struct
PlayerNode
*
)
pokedex
->
player_head
;
while
(
current
!=
NULL
){
...
...
linklist.c
View file @
e73bb7bf
struct
Pokedex
{
struct
PlayerNode
*
player_head
;
struct
PokemonNode
*
pokemon_head
;
};
struct
PokemonNode
{
char
name
[
16
];
char
type
[
12
];
...
...
@@ -17,6 +12,11 @@ struct PlayerNode{
struct
PlayerNode
*
next
;
};
struct
Pokedex
{
struct
PlayerNode
*
player_head
;
struct
PokemonNode
*
pokemon_head
;
};
struct
PokemonNode
*
NewPokemonNode
(
char
name
[
16
],
char
type
[
12
],
char
ability
[
12
]){
struct
PokemonNode
*
newNode
=
(
struct
PokemonNode
*
)
malloc
(
sizeof
(
struct
PokemonNode
));
strcpy
(
newNode
->
name
,
name
);
...
...
@@ -26,7 +26,6 @@ struct PokemonNode* NewPokemonNode(char name[16], char type[12], char ability[12
return
newNode
;
}
struct
PokemonNode
*
FindPokemon
(
struct
Pokedex
*
pokedex
,
char
name
[
16
]){
struct
PokemonNode
*
current
=
(
struct
PokemonNode
*
)
pokedex
->
pokemon_head
;
while
(
current
!=
NULL
){
...
...
@@ -39,7 +38,6 @@ struct PokemonNode* FindPokemon(struct Pokedex *pokedex, char name[16]){
return
NULL
;
}
struct
PlayerNode
*
NewPlayerNode
(
char
name
[
16
],
int
pokemonCount
){
struct
PlayerNode
*
newNode
=
(
struct
PlayerNode
*
)
malloc
(
sizeof
(
struct
PlayerNode
));
strcpy
(
newNode
->
name
,
name
);
...
...
main
View file @
e73bb7bf
No preview for this file type
main.c
View file @
e73bb7bf
...
...
@@ -6,14 +6,6 @@
#include "linklist.c"
#include "functions.c"
int
main
(){
struct
Pokedex
pokedex
;
pokedex
.
pokemon_head
=
NULL
;
...
...
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