LeetCodeBug-Runtime Error Message: reference binding to null pointer of type 'value_type'
在leetcode 1.Two sum 报的错误,翻译一下,为:
Runtime Error Message: reference binding to null pointer of type 'value_type'
运行时错误:引用绑定到类型为“value_type”的空指针。
在平常写代码的时候,如果遇到运行时错误,大多数是指针造成的原因,比如数组越界。
情况一:
有可能是测试数据中包含[]
情况二:
有可能是函数的返回值是NULL,但是其他地方的代码接收到的返回值因为要做一些操作不能为空。
注意这两点应该就能迅速解决大部分问题。