Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

gdb is very nice. I use it with C++ too. Watch sizeof on char arrays. Why is my string's sizeof always 8? That confuses some when starting out.


That's because sizeof is for the size of the variable (a char pointer), not the size of the string up to the null terminator, which is what strlen's for.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: