Array of strings

This is a discussion on Array of strings within the C++ Programming forums, part of the General Programming Boards category; I haven't coded in a while and I've forgotten how to do something like this. Please could someone give my ...

  1. #1
    Registered User cyberCLoWn's Avatar
    Join Date
    Dec 2003
    Location
    South Africa
    Posts
    124

    Array of strings

    I haven't coded in a while and I've forgotten how to do something like this. Please could someone give my memory a little nudge!

    Code:
       char wheels[ ][ 6 ] = { {Cherry, Cherry, Cherry, Plum, Plum, Bell, Bar},
                               {Cherry, Cherry, Plum, Plum, Plum, Bell, Bar},
                               {Plum, Plum, Bell, Bell, Bar, Cherry, Cherry} };

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Code:
    char *wheels[][7] = {
      {"Cherry", "Cherry", "Cherry", "Plum", "Plum", "Bell", "Bar"},
      {"Cherry", "Cherry", "Plum", "Plum", "Plum", "Bell", "Bar"},
      {"Plum", "Plum", "Bell", "Bell", "Bar", "Cherry", "Cherry"}
    };
    My best code is written with the delete key.

  3. #3
    Registered User cyberCLoWn's Avatar
    Join Date
    Dec 2003
    Location
    South Africa
    Posts
    124
    Ah! There we go! Thanks Prelude.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. intializing an array of strings
    By doubty in forum C Programming
    Replies: 4
    Last Post: 06-19-2009, 01:59 PM
  2. Replies: 1
    Last Post: 03-19-2009, 11:56 AM
  3. Build an array of strings dynamically
    By Nazgulled in forum C Programming
    Replies: 29
    Last Post: 04-07-2007, 10:35 PM
  4. Array of strings in C
    By szill in forum C Programming
    Replies: 10
    Last Post: 02-22-2005, 05:03 PM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 10:48 AM

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