2
I know that to access a normal variable within a pointer structure I can use this syntax:
struct teste {
int valor;
int *aponta;
};
struct teste testando, *testado;
testado = &testando;
testado -> valor = 10;
However, how to access the pointer aponta
which is contained in the structure, using the pointer testado
?
This would be an operator
*(ptrStruct->member)
? If so, what would his name be? I did not understand why I had to involve in parenthesis()
followed by an asterisk*
the structure.– gato
@cat The parenthesis is used to group subexpressions. It is the same parenthesis used in
3 * (2 + 4)
. The unary operator*
is the dereference operator and is used to access the contents of a pointer.– Victor Stafusa
Thanks even, I did not find the answer in other places, it was almost obvious. Just add parentheses to respect the order of origin and insert the asterisk to get the reference value;
– Enrico Camponogara Da Silva