Purpose of dereferencing a pointer as a parameter in C.

Posted by Leif Andersen on Stack Overflow See other posts from Stack Overflow or by Leif Andersen
Published on 2010-04-01T03:53:18Z Indexed on 2010/04/01 4:03 UTC
Read the original article Hit count: 393

Filed under:
|
|

I recently came along this line of code:

CustomData_em_free_block(&em->vdata, &eve->data);

And I thought, isn't:

a->b

just syntactic sugar for:

(*a).b

With that in mind, this line could be re-written as:

CustomData_em_free_block(&(*em).vdata, &(*eve).data);

If that's the case, what is the point of passing in

&(*a), as a parameter, and not just a? It seems like the pointer equivalent of -(-a) is being passed in in, is there any logic for this?

Thank you.

© Stack Overflow or respective owner

Related posts about c

    Related posts about indirection