What does the -> operator do in the context of pointers in C++?
- Duplicates the pointer
- Adds values
- Dereferences pointer and accesses member
- Multiplies pointer values
The -> operator in C++ is used with pointers to objects. It dereferences the pointer and accesses the member of the object. For instance, if p is a pointer to an object, p->member accesses the member of the object.
Loading...
Related Quiz
- To loop over each character in a string named myString, one could use for(_______ : myString).
- Which of the following is not a legitimate reason to use function templates?
- Which of the following smart pointers does not take ownership of the pointed object?
- How does C++ treat an enum regarding its type and size?
- The concept of encapsulation involves bundling the data () and the methods () that operate on the data into a single unit.