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

Big difference here between these two, check out a copy of "Deep C Secrets" by Peter van der Linden.

This is ok, safe, complete, reliable:

memset( s, '\0', sizeof( s) );

This yields the perception that it works, depending on what is going to make use of s later on, it could fail to do what you intended depending on how you use s:

s[ 0 ] = '\0';



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: