Thread: typedef for pointer to array of char

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    450

    typedef for pointer to array of char

    Again doing an exercise in C++ Programming Language 3rd edition chapter five.

    This time it's typedefs.
    I can't seem to figure out a typedef for a pointer to an array of char.
    ****
    figured it out
    typedef char (*tpcharray)[size];


    If you read my post about refrence to an array of char, Prelude's solution for declaration is
    char charray[8];
    char (&rcharray)[8]=charray;

    I was using
    char * pachar=charray; // as a pointer to array of char is this correct?
    or is
    char (*pachar)[size]; // the correct way


    or would you do somthing like

    char (*pcharray)[8]=charray;

    I figured out an array of pointers ie
    typedef char* pcharray[8];
    Last edited by curlious; 12-13-2003 at 11:55 AM.

  2. #2
    Disturbed Boy gustavosserra's Avatar
    Join Date
    Apr 2003
    Posts
    244
    An array of chars: char *array[] is equal to char ** const array;
    So, a pointer to an array of pointers to char would be char***pointer. But my compiler accepts char**(*pointer). I do not know why.
    Nothing more to tell about me...
    Happy day =)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  3. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 12:13 AM
  4. linked list inside array of structs- Syntax question
    By rasmith1955 in forum C Programming
    Replies: 14
    Last Post: 02-28-2005, 05:16 PM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM