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
Printable View
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").
calloc is originally from C but you can use it in C++ too.
It puts zeros in the allocated memory chunk :)
calloc - C++ Reference
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.Quote:
Originally Posted by nacho4d
In C++, there is std::fill instead of memset.