pointer to structures

Dear friends

I have a bit basic doubts in pointers and the structures inter relationships.

the first one.

static struct apvt {
int dead;
int pending;
int abouttograb;
}*agents=NULL;

what agents pointer is pointing to ?

second one is

struct apvt *p;
struct apvt *newlyavailable;
if (p == newlyavailable)

actually what are we try to test with this is it mean that both have the same location or so .. ?

third one is

struct apvt *p;
p = agents;

so now what does this p refers to ... ?

with regards
vlrk

It's pointing to nothing. It's just what one call a null pointer.

Yes ! You got it :smiley: . It's testing if both pointers points to the same structure. If so, their contents are the same.

p refers to the same location as agents does, that is, p is a NULL pointer.