Thread: Quick pointer question

  1. #1
    Banned
    Join Date
    Mar 2008
    Posts
    78

    Quick pointer question

    What's the difference between:

    *pointer[10]

    and

    (*pointer)[10]

    and *(pointer[10]) ?

    Thanks.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    *pointer[10] is equivalent to *(pointer[10]), which means "dereference pointer[10]" or "get the object pointed to by pointer[10]". (*pointer)[10] on the other hand, means "gets the 11th element of the array pointed to by pointer".
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 04-04-2009, 03:45 AM
  2. Quick Pointer question
    By Sentral in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2006, 07:36 PM
  3. Simple pointer question
    By jayznz in forum C Programming
    Replies: 2
    Last Post: 04-04-2006, 11:36 PM
  4. Declaring a Pointer (quick question)
    By viciousv322 in forum C Programming
    Replies: 4
    Last Post: 12-16-2005, 11:27 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM