[Leetcode] #1 Two Sum
https://leetcode.com/problems/two-sum/
–
遇到編譯問題
source code
正常運作
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
要嘗試 refactor code, 在執行出錯
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
發現問題出在這行
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
為什麼單純宣告 int array 會出現 segmentation fault
?
宣告 char array 卻沒影響?
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
ptt 版友的協助 (link)
開啟 -wAll
把所有的 warning 秀出來,顯示第十行要初始化
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
–
but 補上去後,編譯過了,但執行反而出問題 … Orz
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
–
問題已解決
原來是只要傳入 function 裡的 argument pointer 都要用 malloc … Orz
git commit
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
–
Final: 補上 Makefile 的編譯器參數、修正報出來的警告與 coding style fix
https://github.com/allenCheng1984/leetcode-notes/commit/b7e6d37afe83f5ed09d928188d44dfb0c98451de