hi
what i would like to do is store the address contained in a pointer variable at a target address pointed at by another pointer.
i have played around abit with the indirection character, which resulted in the alternatives above. alternative2 is what i want to achieve, but the compiler complains and rejects it.
any idea how to do this properly?
thx.
what i would like to do is store the address contained in a pointer variable at a target address pointed at by another pointer.
Code:
typedef struct STRUCTURE
{
char name[30];
struct STRUCTURE *Next;
}DATA;
main()
{
DATA *p0;
DATA *p1;
p0 = p0->Next;
p0 = p1; /* alt1: overwrites pointer, not target address */
*p0 = p1; /* alt2: error. type mismatch */
*p0 = *p1; /* alt3: moves data p1 points to, to where p0 points to */
}
any idea how to do this properly?
thx.