class testClass { public: int B, C; };
testClass u;
testClass * k = &u;
testClass ** m = &k;
*m->B = 1;//Error appears here
I think I've followed the rules of pointer referencing correctly. I still have no idea why this is happening. Could someone help me?
operator-> has higher precedence than operator*, so *m->B is equivalent as *(m->B); while m->B is not valid here.
You should change it to (*m)->B.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With