Thread: dereference pointers

  1. #1
    PC TECH
    Guest

    dereference pointers

    What are two ways to dereference a pointer?

    thanks

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    60

    Dereference

    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?

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Using pointers to pointers
    By steve1_rm in forum C Programming
    Replies: 18
    Last Post: 05-29-2008, 05:59 AM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Staticly Bound Member Function Pointers
    By Polymorphic OOP in forum C++ Programming
    Replies: 29
    Last Post: 11-28-2002, 01:18 PM