Thread: Pointer to Array of Structs

  1. #1

    Pointer to Array of Structs

    Got a quick question for everyone. Let's say that I have an array of pointers that points to an array of structs. Such as:

    HashNode ** Htable; //where HashNode is a struct
    HashNode * pa;

    Now, to access the second element in this array of HashNodes can I just increment pa using the ++ operator or do I need to use the sizeof(HashNode) to increment this to the next element in the array?

    Thanks for the Help.

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    just use ++ as in


    the size of each element is automatically taken into account(that is if your not doing crazy stuff you probably shouldnt be).
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Are you aware that you can also say pa[x][y]...


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  2. pointer to multidimensional array
    By Bigbio2002 in forum C++ Programming
    Replies: 4
    Last Post: 02-05-2006, 10:29 PM
  3. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 01:34 PM
  4. accessing array of structs values
    By WaterNut in forum C++ Programming
    Replies: 12
    Last Post: 07-08-2004, 08:47 PM
  5. Replies: 41
    Last Post: 07-04-2004, 03:23 PM