I'm writing a C++ program and I have to use memcpy at some point.
I will explain my problem:
I have a simple struct named A and a class named B and I do the following:
Now,at some point of my program I have an object of type B
a2=//assign a2 with a value
and memcpy works fine.
In another part of my program I have a pointer to an object of type B
as I call a function in which I send an object of type B like this:
and when I get the results of memcpy it returns garbage or memory addresses,but not the value of a2 as it does above.So I think it must be pointer's fault..
Does anybody have any idea how to fix it?