What does (->) does? Please with code example
As we use . operator with class or structure or any other user defined data type.
-> operator is used with pointer of those data types
eg
1 2 3 4 5 6 7 8 9
|
struct str{
int a;
};
//in main
str aa;
aa.a=5;
str *p=&aa;
p->a=5;
|
Last edited on
Accessing member of object via pointer to that object is one place, but C++11 has also suffix return type syntax, where -> is used.