dereference pointers

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...

  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, 05:23 AM
  2. Using pointers to pointers
    By steve1_rm in forum C Programming
    Replies: 18
    Last Post: 05-29-2008, 06: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21