Mam takie stuktury:
struct player_data{
unsigned int x;
unsigned int y;
unsigned int deaths;
};
struct ball_data{
unsigned int x;
unsigned int y;
bool mv_left;
bool mv_right;
bool mv_up;
bool mv_down;
};
struct game_data{
unsigned int max_field_x;
unsigned int max_field_y;
struct player_data *player;
struct ball_data *ball;
};
poprzez strukture game_data moge dojsc do danych z pozostalych dwoch struktur, teraz, zrobilem sobie wskaznik na to w ten sposob
struct game_data *gd;
I teraz mam pytanie w dwoch czesciach, po pierwsze, dlaczego zawsze musze w funkcji main uzywac np
gd->player->x
a nie moge np
gd.player.x
?
Oraz po drugie, jak moge ta strukture game_data przekazac do funkcji teraz zebym mial w funkcji dostep do wszystkich elementow struktury game_data i elementow tych dwoch struktur ktore ona zawiera ?