Why do pointers use -> instead of .?
c++, pointers, struct
Solution
The . operator accesses a member of a structure and can operate only on structure variables. If you want to do this to a pointer, you first need to dereference the pointer (using `*`) and then access the member (using `.`). Something like
(*ptrMovie).year = 1999
The `->` operator is a shorthand for this.
Problem
Possible Duplicate: Why does C have a distinction between -> and . ? Lets say that I have this structure: ``` struct movies { string title; int year; } my_movie, *ptrMovie; ``` Now I access `my_movie` like this: `my_movie.year = 1999;` Now to access a pointer I must do this: `ptrMovie->year = 1999;` Why do pointers use the `->` operator and normal data types use the `.` operator? Is there any reason they couldn't both use the `.` operator?