Thread: how they make "text" into 2D array with only one astrix..

  1. #1
    Banned
    Join Date
    Oct 2008
    Posts
    1,535

    how they make "text" into 2D array with only one astrix..

    Code:
    char *text[]={"aac","aa","bbb","aac","aa","aabc","a"}
    as i see it
    they say
    that
    text[] is an array of chars
    but for that
    we need only
    char* text.
    i know that adding [] creates another dimention
    but i cant see how they set they set the length and the width of the 2D
    array
    ??

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That is because it is not a 2D array. It is a 1D array of pointers to the original text-string produced by the compiler.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. double astrix 2D array signature question..
    By transgalactic2 in forum C Programming
    Replies: 18
    Last Post: 04-09-2009, 12:43 PM
  2. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 10:33 AM
  3. Comparing a 2d Array (newbie)
    By Cockney in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2001, 12:15 PM
  4. how to pass 2D array into function..?
    By IngramGc in forum C++ Programming
    Replies: 2
    Last Post: 10-21-2001, 08:41 AM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM