why variable in struct wont get the new value

I have this test code

typedef struct StuctTest
{
	int16_t ValueToStoreA;
	int16_t ValueToStoreB;
	StuctTest()
	{
	}
	StuctTest():
		ValueToStoreA(-1),
		ValueToStoreB(-1)
	{
	}
};

//.h file
class Tester  {
public:
	void DoStuff();
	void SetStructTest(StuctTest test);
private:
	StuctTest CurrentStuctTest;
};


void Tester::SetStructTest(StuctTest test)
{
	CurrentStuctTest = test;
}
void Tester::DoStuff()
{
	uint16_t someValueA = 0;
	uint16_t someValueB = 1;

	CurrentStuctTest.ValueToStoreA = someValueA;//wont set someValueA(0) to ValueToStoreA
	CurrentStuctTest.ValueToStoreB = someValueB;//wont set someValueB(1) to ValueToStoreB

	CurrentStuctTest.ValueToStoreA = 0;//it works
	CurrentStuctTest.ValueToStoreB = 1;//it works
}

why setting raw integer works, while setting a variable doesn’t.

How do you know that it doesn't work? I don't see any print statements there.

sorry I removed the Serial print lines to make code more clean.

OK, show us where they went and what they gave for output.

Damn, why everybody always worries so much about giving us something "clean" and "short" but nobody every gives one little thought to giving us anything that actually evidences the problem. If people would put half as much effort into giving us all the facts as they did about trying to strip away what they "think" we don't need we would solve half of these problems on the first response.

Delta_G:
OK, show us where they went and what they gave for output.

Damn, why everybody always worries so much about giving us something "clean" and "short" but nobody every gives one little thought to giving us anything that actually evidences the problem. If people would put half as much effort into giving us all the facts as they did about trying to strip away what they "think" we don't need we would solve half of these problems on the first response.

Please calm down, I found the problem. And apparently it was in the code I posted.

I changed

StuctTest CurrentStuctTest;

to

StuctTest *CurrentStuctTest;

and updated rest of methods.

Thank you :slight_smile:

PS : The reason I stripped the code, so the person who is trying to help can understand the problem quickly. I believe that nobody has time to read 1000 of lines of code.

I'm not uncalm, I just don't understand. It seems like when you have a question like this the intelligent thing to do would be to give as much information as possible. But most posters here seem to take the opposite approach. I just don't get what their thinking might be.