I am new to C programming and I have a question,
If I have a structure, for example, and I point to it, I want to create a new pointer to point to the same data, but not for two pointers pointing to the same object. How can I do this without copying each individual field in the structure?
typedef struct { int x; int y; int z; }mySTRUCT; mySTRUCT *a; mySTRUCT *b; a->x = 1; a->y = 2; a->z = 3;
and now I want b to point to the same data
b = *a
this is not correct and the compiler yells at me
any help would be wonderful! thanks:)
source share