Pointer to array of string and Array of Pointer to String

This is a discussion on Pointer to array of string and Array of Pointer to String within the C Programming forums, part of the General Programming Boards category; Pointer to array of string and Array of Pointer to String refer to the same thing? Pointer to array of ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    99

    Pointer to array of string and Array of Pointer to String

    Pointer to array of string and Array of Pointer to String refer to the same thing?

    Pointer to array of string - is a 2D array of char

    Code:
    char s[2][3] = {...};
    how to declare a pointer to such an array ?


    Array of Pointer to String

    Code:
    char * s[2][3] = {...};

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Different.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,546
    > Pointer to array of string - is a 2D array of char
    1. What do you regard as being a 'string'. There's no such thing in C unless you declare it.
    2. Your declaration doesn't match the words (in any scenario).
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 03-03-2006, 01:11 AM
  2. Replies: 10
    Last Post: 11-06-2005, 08:29 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08:32 AM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21