initialising 2-dim char array

This is a discussion on initialising 2-dim char array within the C Programming forums, part of the General Programming Boards category; how do i allocate memory to a 2-dim char array: char **array; can i set and look at a row ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    351

    initialising 2-dim char array

    how do i allocate memory to a 2-dim char array:

    char **array;

    can i set and look at a row like one whose size is specified?
    e.g.

    strcpy(array[0],"This is an example");

    printf("output : %s\n",array[0]);

    TIA, rotis23

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    A good paper to read.

    Also, do a board search, this has been asked a few times before.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    thanks hammer (again),

    the link seems to be broken.

    can't seem to find an answer to this problem.

    maybe i just can't search!

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    The link does work from here, must be your ISP or something.

    In the meantime, review this thread:
    http://www.cprogramming.com/cboard/s...threadid=17742

    Make sure you read all the posts in it.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    ok, thats good info.

    gonna use a linked list though.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 09:54 PM
  2. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 01:13 AM
  3. NULL terminating a multi dim char array
    By NickESP in forum C++ Programming
    Replies: 2
    Last Post: 02-05-2003, 03:43 PM
  4. Creating 2D arrays on heap
    By sundeeptuteja in forum C++ Programming
    Replies: 6
    Last Post: 08-16-2002, 12:44 PM
  5. Strings are V important...
    By NANO in forum C++ Programming
    Replies: 15
    Last Post: 04-14-2002, 12:57 PM

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