Why does the arrow (->) operator in C exist?
The dot (.)
operator is used to access an individual of a struct, while the arrow operator (->)
in C is used to access a member of a struct which is referenced by the pointer in question.
The pointer itself does not have any members which could be accessed with the dot operator (it's actually only a number describing a location in virtual memory so it doesn't have any members). So, there would be no ambiguity if we just defined the dot operator to automatically dereference the pointer if it is used on a pointer (information which is known to the compiler at compile time afaik).
So why have the language creators decided to make things more complicated by adding this seemingly unnecessary operator? What is the big design decision?