lpcware

memcpy struct to array

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by terrype on Sun Nov 23 20:57:58 MST 2014
Dear Friends, 
struct
{
  unsigned char x1;
  unsigned char y1;
  unsigned int    z1;
}abc1;

struct
{
  unsigned char x2;
  unsigned char y2;
  unsigned int    z2;
struct abc1        lpc1;
}abc2;

struct
{
  unsigned char x2;
  struct abc2        lpc2;

}abc3;


unsigned char   test[256];
strcut abc3    test_abc;

memcpy(test, test_abc, sizeof(struct abc3));

when i call this function, it copies struct  test_abc to test with additional byte  00 aftre lpc1, is any one facing this issue?

Outcomes