最近的C++ int
initialization 总是出错,在这里提醒自己一下。
无论是数组还是变量的初始化,一定要explicitly set 0.
example:
int* rows;
int* cols;
int diagonal;
int anti_diagonal;
rows = new int[n]{0};
cols = new int[n]{0};
diagonal = 0;
anti_diagonal = 0;
最近的C++ int
initialization 总是出错,在这里提醒自己一下。
无论是数组还是变量的初始化,一定要explicitly set 0.
example:
int* rows;
int* cols;
int diagonal;
int anti_diagonal;
rows = new int[n]{0};
cols = new int[n]{0};
diagonal = 0;
anti_diagonal = 0;
本文标题:c++ int initialization
本文链接:https://www.haomeiwen.com/subject/qplapttx.html
网友评论