c - Accessing the structure using a pointer -


i have declared structure "node" having member variable 'm' , defined 2 variables below

struct node t, *p; 

later in program assigned address of t p:

p = &t; 

to access member variable need use p->m.

but wanted use * operator, writing *p.m gives error. why ?

for have see precedence of operators.

the precedence of . operator higher * operator.

writing *p.m makes compiler think *(p.m).

you have use (*p).m.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -