Thread: Assigning One dimensional array to two dimensional array

  1. #1
    Registered User
    Join Date
    Mar 2014

    Assigning One dimensional array to two dimensional array

    Hi Guys,

    is it allowed to to like this:

    char a[10] = "Lizard";
    char b[2][5];
    b[0][0] = a[0];
    b[0][1] = a[1]; etc?

    Thank you.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Yes, you're basically assigning one char variable to another, except that they are elements of arrays.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 09-02-2013, 07:50 PM
  2. Replies: 4
    Last Post: 09-02-2013, 11:19 AM
  3. Replies: 9
    Last Post: 05-29-2010, 10:32 AM
  4. Replies: 24
    Last Post: 11-11-2008, 01:39 PM
  5. Replies: 1
    Last Post: 04-25-2006, 12:14 AM