结构释放内存功能-c

I have a program i made and its running perfectly! the only problem is the free pointers function this is a link for the full code https://codeshare.io/aVE3n3

问题是我成功释放了播放器名称指针,但是在程序不允许我释放播放器的指针之后。 我很想得到一些帮助,谢谢。

    void freeTeam(team* t,int size)
{
    int temp;
    for (int j = 0; j < size; j++)
    {
        temp = t[j].current_players;
        for (int i = 0; i < temp; i++)
        {
            free(t->players[i].name);
        }
        free(t->players);
        for (int i = 0; i < temp; i++)
        {
            free(t[i].team_name);
        }
        free(t[j]);
    }
}
评论