Hello there,
Suppose I've got the following structure:
Code:
typedef struct s_no *p_no;
struct s_no {
int value;
p_no next;
};
And:
Code:
void insert_beginning(p_no *pL, p_no y)
{
y->next = *pL;
*pL = y;
}
This function is used like this:
Code:
p_no L = NULL, x;
p_no x = (p_no) malloc(sizeof(struct s_no));
insert_beginning(&L, x);
My doubt is, after calling that function, L and x will store the same address, and also L->next will be the same as x->next, right?
So what's the difference between the function above and this one, where instead of passing &L to it I'd pass only L:
Code:
void insert_beginning(p_no pL, p_no y)
{
y->next = pL;
pL = y;
}
I tried it but the results were different, L stores the 0x0 address while x stores something else, but I couldn't figure out why.
I appreciate any help.