Write access to the member of a structure with a pointer instead of using the "-"

2

How would you write this assignment:

p1->caracter='B';

otherwise using * instead of -> ?

    
asked by anonymous 29.08.2018 / 22:43

1 answer

2

You first get the value of the object and then access the member normally:

(*p1).caracter = 'B';

This operator is just a way to derrefer the pointer and access its member.

    
29.08.2018 / 22:46