Hi. I have a question about one function in my program. Write a function that will replace players in a tim. New player gets in the game, and takes the place of one that leaves. Prototype of function is:

void replace(TEAM *p,PLAYER newplayer,int num)

where second parameter is new player, and the third is a jersey number of player who leaves the game.
Two structures are defined as:

typedef struct
    char name[25],surname[25];int number;

typedef struct
    char nameofteam[25];int numberofplayers;PLAYER *players;

First I tried to read which player should get out, but that didnt work:

 printf("which player should get out?\n");
 while(p->players.number);//Choose one of previously read players

Second thing is to read a new player and replace him with the chosen who leaves.

Let me know if you have an idea. Thanks for replies.

Have some sorta stack. If a player leaves pop them from the stack. Player joins, push them into the empty slot.