Thread: Array of strings

  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,897
    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, 12:59 PM
  2. Replies: 1
    Last Post: 03-19-2009, 10:56 AM
  3. Build an array of strings dynamically
    By Nazgulled in forum C Programming
    Replies: 29
    Last Post: 04-07-2007, 09: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, 09:48 AM