Hi,
I have the following Struct,
Struct Sample
{
int i;
char *p;
};
int main()
{
Sample a;
a.p = malloc(10);
Sample b;
b = a;
}
Now i think a shallow copy is done and if i destry only on the object
there would be a dangling pointer.
How do i overcome this problem as C structures don't support
functions?
Thanks in advance!!!
I have the following Struct,
Struct Sample
{
int i;
char *p;
};
int main()
{
Sample a;
a.p = malloc(10);
Sample b;
b = a;
}
Now i think a shallow copy is done and if i destry only on the object
there would be a dangling pointer.
How do i overcome this problem as C structures don't support
functions?
Thanks in advance!!!
Comment