In C we set data to 0 with memset()
function (Not only for the initialization).
My data could be changed by another method and I want to reuse it and then I want to set it to 0 before reusing it
Are there another way to set data to 0 in C++ other than memset()
?
class MYClass : public NameSpace::ParentClass {
private:
struct mystruct data
public:
void method();
};
void MYClass::method() {
memset(&data, 0, sizeof(data)); // it's the C way. Are there another way in C++
}