You can try using the normal objects. Data cannot be initialized inside a structure implicitly in c. A object has to be created and data has to be fed in.
If the structure looks like this
typedef unsigned int UINT32;
struct Word{
UINT32 a;
UINT32 b;
UINT32 c;
UINT32 d;
};
Without using pointers:
Word xx , yy={0,1,2,3};
xx = yy;
xx.a = 10;
yy.b = 100;
printf("%d -- %d -- %d -- %d",yy.a,yy.b,yy.c,yy.d); // 0 -- 100 -- 2 -- 3
printf("%d -- %d -- %d -- %d",xx.a,xx.b,xx.c,xx.d); // 10 -- 1 -- 2 -- 3
Here xx and yy are different objects created for Word. yy object data is copied to xx. When making changes to element of xx will not affect yy data because both are differnet objects.
When using pointers:
struct Word *xx;
struct Word *yy=malloc(sizeof(struct Word));
yy->a=0;
yy->b=1;
yy->c=2;
yy->d=3;
xx=yy;
xx->a = 10;
yy->b = 100;
printf("%d -- %d -- %d -- %d",yy->a,yy->b,yy->c,yy->d); // 10 -- 100 -- 2 -- 3
printf("%d -- %d -- %d -- %d",xx->a,xx->b,xx->c,xx->d); // 10 -- 100 -- 2 -- 3
Here you have allocated memory for xx and initialized data to it. Both xx and yy point to a same memory location so changing data in either xx or yy will affect both.