Thread: Question related to array and pointers

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    4

    Question related to array and pointers

    There is Array of Pointer:int *ptr[]
    Pointer To Pointer:int **ptr

    then is there a stuff : Pointer of Arrays?

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    i think there is, but i can't think right now. maybe in the morning...

    in any case, you're looking for english to C++ translations. english is very different from c++. some stuff which makes perfect sense in c++ is nearly inexplicable in english, and vice versa. (which can explain why so many people learn better from code than from articles)

  3. #3
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    pointer of arrays...

    Doesn't make much sense to me. You can have an array of pointers as you've shown but I'm not sure about a pointer of arrays, it just sounds wrong.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    An array of pointers is basically a pointer to a pointer, just different syntax.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    Registered User
    Join Date
    Jul 2002
    Posts
    4
    Pointers of Array doesnt makes sense?

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Originally posted by Q4u
    Pointers of Array doesnt makes sense?
    You can think of an array as a pointer. So, a pointer to an array is really just a pointer to a pointer. People use subscripting because it is easier to read.

  7. #7
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    >> then is there a stuff : Pointer of Arrays?

    I think what Q4u meant was to say pointer to array.

    You can declare a pointer to an array like this:

    int (*ptr)[10];

    ptr would thus be a pointer to an array of 10 elements.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array pointers question?
    By ben2000 in forum C Programming
    Replies: 4
    Last Post: 07-26-2007, 01:31 AM
  2. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM