4 ms·
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.
by 16s 14y ago
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.
- lysol 14y agoThat'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.