Initialized variable in a structure has garbage value c++

I’ve initialized all value in a structure like what I said.

but when I check the value after creation of the structure,

they have garbage value in some variable…

Is there any solution to fix this?

the structure like this…

struct A
{
 A()
{
  b.clear();
}

int c = 0;
int d = 0;
std::wstring d = L"";

std::vector< int, anothoerStruct > b;
};


Source: c++

Leave a Reply