Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
16s
on Aug 27, 2012
|
parent
|
context
|
favorite
| on:
Learning C with gdb
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
on Aug 27, 2012
[–]
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: