Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef PLAYER_H_INCLUDED
- #define PLAYER_H_INCLUDED
- typedef struct Pocao{
- int codigo;
- }POCAO;
- typedef struct inventario{
- int tamanho;
- POCAO*pocoes;
- }INVENTARIO;
- typedef struct personagem{
- char*classe;
- INVENTARIO*inventario;
- }PERSONAGEM;
- typedef struct player{
- char* nome;
- PERSONAGEM*personagem;
- }PLAYER;
- POCAO* Cria_Pocao();
- PERSONAGEM*Cria_Personagem();
- INVENTARIO *Cria_Inventario();
- PLAYER*Cria_Player();
- #endif // PLAYER_H_INCLUDED
- #include<stdio.h>
- #include<stdlib.h>
- #include"Player.h"
- PLAYER*Cria_Player()
- {
- Cria_Personagem();
- return (PLAYER*)malloc(sizeof(PLAYER));
- }
- PERSONAGEM*Cria_Personagem()
- {
- Cria_Inventario();
- return (PERSONAGEM*)malloc(sizeof(PERSONAGEM));
- }
- INVENTARIO*Cria_Inventario()
- {
- Cria_Pocao();
- return (INVENTARIO*)malloc(sizeof(INVENTARIO));
- }
- POCAO*Cria_Pocao()
- {
- return(POCAO*)malloc(sizeof(POCAO));
- }
- #include <stdio.h>
- #include <stdlib.h>
- #include"Player.h"
- int main()
- {
- FILE*arquivo;
- PLAYER*lista;
- int i;
- lista=(PLAYER*)malloc(sizeof(PLAYER)*6);
- for(i=0;i<6;i++)
- {
- lista[i]=Cria_Player();
- }
- printf("Hello world!n");
- return 0;
- }
Add Comment
Please, Sign In to add comment