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
9d1811c4
Commit
9d1811c4
authored
Jan 02, 2023
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
need to create pokedex of type pokedex
parent
56d543e5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
main.c
main.c
+23
-6
No files found.
main.c
View file @
9d1811c4
...
...
@@ -9,11 +9,9 @@ A-J Towse
*/
//Create struct Pokedex with a pointer to head of Pokemon and head of Player
//Create variable of type Pokedex called pokedex.
typedef
struct
Pokedex
{
struct
Pokemon
*
Pokemonhead
;
struct
Player
*
Playerhead
;
struct
Pokedex
*
pokedex
;
struct
PokemonNode
*
ptrToPokemonhead
;
struct
PlayerNode
*
ptrToPlayerhead
;
}
Pokedex
;
//Create struct PokemonNode with name,type,ability variables
...
...
@@ -38,9 +36,14 @@ typedef struct PlayerNode {
struct
PokemonNode
pokemonList
[];
}
PlayerNode
;
PokemonNode
*
head
=
NULL
;
//Create head for DLL of pokemon
PlayerNode
*
head
=
NULL
;
//Create head for DLL of players
//NEED TO CREATE VARIABLE OF TYPE POKEDEX
//Define functions for PokemonNode struct
struct
PokemonNode
*
NewPokemonNode
(
char
name
[],
char
type
[],
char
ability
[]
);
void
AddPokemonToList
(
struct
Pokedex
*
pokedex
,
char
name
,
char
type
,
char
ability
);
void
AddPokemonToList
(
struct
Pokedex
*
pokedex
,
char
name
[],
char
type
[],
char
ability
[]
);
struct
PokemonNode
*
FindPokemon
(
struct
Pokedex
pokedex
,
char
name
);
//Define functions for PlayerNode struct
...
...
@@ -72,11 +75,25 @@ struct PokemonNode * NewPokemonNode(char name[], char type[], char ability[] ) {
return
newNode
;
}
//Create AddPokemonToList function - returns void
void
AddPokemonToList
(
struct
Pokedex
*
pokedex
,
char
name
[],
char
type
[],
char
ability
[]){
NewPokemonNode
(
name
,
type
,
ability
);
}
int
main
(
void
)
{
NewPokemonNode
(
"Charmander"
,
"Fire"
,
"FireBallz"
);
//NewPokemonNode("Charmander","Fire","FireBallz");
AddPokemonToList
(
pokedex
,
"Charmander"
,
"Fire"
,
"FireBallz"
);
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