What are two ways to dereference a pointer?
thanks
This is a discussion on dereference pointers within the C++ Programming forums, part of the General Programming Boards category; What are two ways to dereference a pointer? thanks...
What are two ways to dereference a pointer?
thanks
int* Pointer1=0;
*Pointer1; //will show what is held at the address stored in Pointer1
The other way is for objects of user defined classes;
Car* theCar= new Car(Red, Sports, 50000);
theCar->GetColor();
Does that make sense?
This sounds like a homework question...
One is using the ->, and the other is a combination of brackets and the . operator. Try and figure it out.