copying a struct with a struct member to another struct

Posted by user1839295 on Stack Overflow See other posts from Stack Overflow or by user1839295
Published on 2012-12-03T10:54:47Z Indexed on 2012/12/03 11:08 UTC
Read the original article Hit count: 332

Filed under:
|

is the following code correct?

   typedef struct
   {
      int x;
      int y;
   } OTHERSTRUCT;


   struct DATATYPE
   {
      char a;
      OTHERSTRUCT b;
   }

   // ...

   // now we reserve two structs
   struct DATATYPE structA;
   struct DATATYPE structB;

   // ... probably fill insome values


   // now we copy structA to structB
   structA = structB;

Are both structs now completely identical? Even the "struct in the struct"?

Thanks!

© Stack Overflow or respective owner

Related posts about c

    Related posts about struct