Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Here's the include blah, blah,
- // #define blah blah
- // Before you write the functions and all that, you need to declare the existence of your custom data-type.
- // That's why you use typedef struct, as shown below.
- typedef struct {
- char name[10];
- int level,
- hp,
- atk,
- def,
- spatk,
- spdef,
- spd;
- } pokemon;
- // Here's how you would use it inside the code:
- int main()
- {
- // We can now have a custom datatype called Pokemon!
- pokemon electabuzz;
- // How do you access the elements inside it?
- // Just add a period...
- electabuzz.name = "Electabuzz";
- electabuzz.level = 100;
- // etc
- // You can do various comparison factors with these...
- // like say, if(electabuzz.level > psyduck.level) or something.
- // It's like another way to name a variable.
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement