Is there anyway I can copy a string into a 2 dimensional string array?

This is a discussion on Is there anyway I can copy a string into a 2 dimensional string array? within the C++ Programming forums, part of the General Programming Boards category; Is that possible?...

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    51

    Is there anyway I can copy a string into a 2 dimensional string array?

    Is that possible?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    A single string would seem to only occupy one slot of an array of strings. Is that what you mean, or are you looking for something more sinister?

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    51
    let say I have

    Code:
    char a[20]={abcd}
    
    char b[10][20];
    I want to copy the a string to b

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    (1) "copy the a string to b" doesn't make sense

    (2) b is not a two-dimensional array of strings (it is a one-dimensional array of 19-character strings).

    (3) Are you sure you don't want the C Forum instead?

    (4) Really, really sure?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-10-2008, 11:29 AM
  2. How to put a string in a 2 dimensional character array?
    By atif7865 in forum C Programming
    Replies: 2
    Last Post: 12-05-2008, 10:26 PM
  3. String-length of an multi-dimensional array
    By doxii in forum C Programming
    Replies: 15
    Last Post: 10-30-2008, 03:36 PM
  4. two dimensional string array question
    By Hoser83 in forum C Programming
    Replies: 8
    Last Post: 02-07-2006, 08:15 PM
  5. string into 2 dimensional array - basic stuff
    By mellisa in forum C++ Programming
    Replies: 11
    Last Post: 01-18-2003, 03:08 AM

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