If I have :
char *name; //this is in a struct
*row->name //row is able to get in the struct
How do I read *row->name and what is it returning?
I'll link the code I am reading: http://pastebin.com/MvLXkDCz
If I have :
char *name; //this is in a struct
*row->name //row is able to get in the struct
How do I read *row->name and what is it returning?
I'll link the code I am reading: http://pastebin.com/MvLXkDCz
First the -> operator is evaluated and then the resulting pointer which is pointing to what name points to is dereferenced with *. So it's the same as
row->name[0]
and IMHO this is a better way of expressing the same (althought sometimes using the indirection operator * is clearer).
The -> component selection operator has higher precedence than the unary * operator, so *row->name is parsed as *(row->name); you're dereferencing the row->name member.
The same is true for all other postfix1 operators:
*arr[i] == *(arr[i])
*foo() == *(foo())
*a.p == *(a.p)
*p++ == *(p++)
*q-- == *(q--)