I am trying to clear all the individual bits in an unsigned char and i assigned the char to zero.I am not sure if thats the right way
I am trying to clear all the individual bits in an unsigned char and i assigned the char to zero.I am not sure if thats the right way
That is one way (though you probably meant "I assigned zero to the char").
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
calloc is originally from C but you can use it in C++ too.
It puts zeros in the allocated memory chunk
calloc - C++ Reference
Mac OS 10.6 Snow Leopard : Darwin
calloc is a wrong solution here both in C and C++ since its primary purpose is dynamic memory allocation. You were probably thinking of memset instead.Originally Posted by nacho4d
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
In C++, there is std::fill instead of memset.