Skip to content

Commit c288887

Browse files
authored
Update and rename fill.cpp to fill_memset.cpp
1 parent a05319e commit c288887

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Template/CPP_LANG/fill.cpp renamed to Template/CPP_LANG/fill_memset.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ main() {
1111
int low[n+10][K+10]; memset(low, 0x3f, sizeof(low)); // set 0x3f3f3f3f for all. This is a big positive number
1212
int upp[n+10][K+10]; memset(upp, 0xcf, sizeof(upp)); // set 0xcfcfcfcf for all. This is a big negative number.
1313
}
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

Comments
 (0)