leetcode遇到的錯誤

各種內存錯誤

AddressSanitizer: stack-overflow on address 0x7fff4d466ff8 (pc 0x0000004122c9 bp 0x7fff4d467030 sp 0x7fff4d466ff0 T0)
這種一般是系統棧溢出了,可能是因爲無限遞歸導致的,應該檢查一下遞歸條件是不是不合適。

runtime error: reference binding to misaligned address 0xbebebebebebec0ba for type ‘int’, which requires 4 byte alignment (stl_deque.h)
0xbebebebebebec0ba: note: pointer points here

指針亂指!例如棧爲空時調用top()函數,會導致越界報錯

stack<int> s;
s.top();    //這樣會導致編譯出錯

函數錯誤

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章