Thread: Pointer problem

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    16

    Pointer problem

    I have unsuccessfully been able to create a pointer for the following data structures

    Code:
    char hpfpID[55][4][60];
    char hpopID[55][4][60];
    char lpfpID[55][4][60];
    char lpopID[55][4][60];
    I would like to create a pointer so that I can set equal to address of one of the above data structures and then use as I like.

    For example:

    Code:
    /* stupid example */
    ptr = hpfpID;
    printf("%s\n",ptr[0][0]);
    Any help would be appreciated

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    char **ptr;
    ptr = hpfpID[index];

    Where index is a number in range 0 to 54.

    Is that what you're looking for?
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    char (*lpPointerToMulti)[4][60]=hpfpID;
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointer to pointer realloc problem
    By prakash0104 in forum C Programming
    Replies: 14
    Last Post: 04-06-2009, 08:53 PM
  2. Another pointer problem
    By mikahell in forum C++ Programming
    Replies: 21
    Last Post: 07-20-2006, 07:37 PM
  3. Pointer problem
    By mikahell in forum C++ Programming
    Replies: 5
    Last Post: 07-20-2006, 10:21 AM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. pointer problem
    By DMaxJ in forum C Programming
    Replies: 4
    Last Post: 06-11-2003, 12:14 PM