leetcode 报错

  1. 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]

  2. C++ requires a type specifier for all declarations dp[0]=0;
    翻译:
    c++要求所有声明都有类型说明符
    没彻底理解,但是知道了解决方法
    出错原因: 代码片段没有写在函数中。
    解决方法: 将代码片段写进函数中。

  3. runtime error: addition of unsigned offset to 0x602000000010 overflowed to 0x60200000000c (stl_vector.h)
    翻译:
    无符号偏移量从0x602000000010溢出到0x60200000000c (stl_vector.h)
    解决:
    避免数组下标小于0

  4. reference binding to null pointer of type 'int' (stl_vector.h)
    翻译:引用绑定到类型为int的空指针
    原因:在声明vector容器的时候没有指定大小,但是在用的时候当作指定了大小的数组用了。
    解决:
    用push_back

  5. runtime error: member access within null pointer of type 'ListNode' (solution.cpp) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:33:20
    翻译:试图使用空指针
    解决:检查是否指针越界了 增加判断条件

  6. runtime error: member access within misaligned
    引用:https://zhuanlan.zhihu.com/p/339293813
    在这里插入图片描述
    runtime error 问题 一般就是数组字符串越界问题

an instance of 'std::out_of_range’报错处理

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值