-
Line 7: Char 9: runtime error: index 30 out of bounds for type 'int [30]' (solution.cpp) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:16:9
数组越界,把int[30]改成int[31] -
C++ requires a type specifier for all declarations dp[0]=0;
翻译:
c++要求所有声明都有类型说明符
没彻底理解,但是知道了解决方法
出错原因: 代码片段没有写在函数中。
解决方法: 将代码片段写进函数中。 -
runtime error: addition of unsigned offset to 0x602000000010 overflowed to 0x60200000000c (stl_vector.h)
翻译:
无符号偏移量从0x602000000010溢出到0x60200000000c (stl_vector.h)
解决:
避免数组下标小于0 -
reference binding to null pointer of type 'int' (stl_vector.h)
翻译:引用绑定到类型为int的空指针
原因:在声明vector容器的时候没有指定大小,但是在用的时候当作指定了大小的数组用了。
解决:
用push_back -
runtime error: member access within null pointer of type 'ListNode' (solution.cpp) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:33:20
翻译:试图使用空指针
解决:检查是否指针越界了 增加判断条件 -
runtime error: member access within misaligned
引用:https://zhuanlan.zhihu.com/p/339293813
runtime error 问题 一般就是数组字符串越界问题
an instance of 'std::out_of_range’报错处理