3 ms·
Kind of bound to the semantics, though. E.g. - memset( s, '\0', sizeof( s) ); s[ 0 ] = '\0'; You can of course create a library (e.g. https://github.com/rob
by Roboprog 15y ago
Kind of bound to the semantics, though.
E.g. -
memset( s, '\0', sizeof( s) );
s[ 0 ] = '\0';
You can of course create a library (e.g. https://github.com/roboprog/buzzard/blob/master/bzrt/src/bzrt_bytes.h https://github.com/roboprog/buzzard/blob/master/bzrt/src/bzr...) to support alternate implementations (as interpreters and VMs created in C must), but it's not really much like ANSI C anymore.
- jebblue 15y agoBig 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';