Copy a Structure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi ,
in C, How do I copy a contents of a Structure pointer to a Structure
Variable. e.g
struct A var1;
struct A *Var2;

I want to copy contents of Structure pointed to by Var2 to a Structure var1.
Is there any standard library function to do the same?

Thanks and Regards,
 
Thanks Jochen,
var1=*var2 will copy the contents of structure pointed
to by var2 into var1. One more thing I wanted to ask was how do I copy the
contents of the structure var1 into the structure pointed to by var2?
var2=&var1 will make var2 point to the var1 struture.

thanks again,
 
Pravin Prabhu said:
Thanks Jochen,
var1=*var2 will copy the contents of structure pointed
to by var2 into var1. One more thing I wanted to ask was how do I copy the
contents of the structure var1 into the structure pointed to by var2?
var2=&var1 will make var2 point to the var1 struture.

*Var2 = var1;
thanks again,
Schobi

[...]

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"Coming back to where you started is not the same as never leaving"
Terry Pratchett
 
Back
Top