We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a05319e commit c288887Copy full SHA for c288887
Template/CPP_LANG/fill.cpp renamed to Template/CPP_LANG/fill_memset.cpp
@@ -11,3 +11,5 @@ main() {
11
int low[n+10][K+10]; memset(low, 0x3f, sizeof(low)); // set 0x3f3f3f3f for all. This is a big positive number
12
int upp[n+10][K+10]; memset(upp, 0xcf, sizeof(upp)); // set 0xcfcfcfcf for all. This is a big negative number.
13
}
14
+
15
+// 如果 low 不是真正的二维数组(例如你用了 int** low 或 vector<vector<int>> low),那么 sizeof(low) 不会返回元素占用的总字节数(对于指针 it'll be pointer size),memset 的长度参数会不正确导致越界或只初始化了指针。如果使用动态分配/vector,请用 std::fill 或 fill_n
0 commit comments