typedef int scorers[LESSONS_NUM]
int *pScorer = new scorers;
delete pScorers; //Wrong!!!
delete[] pScorers; //Right
为了避免这样的错误,建议不要对数组类型typedef,或则采用STL中的vector代替数组。
释放typedef的数组,用delete还是delete[]
最新推荐文章于 2021-01-15 19:31:10 发布