#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    1
    Rep Power
    0

    Question Please help me with arrays


    I have a homework to create some arrays but at a point the elements of the array must be strings. i can give an example

    char MyArray[5][5];
    MyArray[5][4] = "Username";

    I can solve this problem using pointers but my teacher told me not to use pointers if i use he will cancel my homework
    Can anyone help me?
    By the way he said that i can use string.h library but i coudn't use that!!
    Thanks
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,255
    Rep Power
    2222
    STOP SHOUTING AT US!

    So use a 2-D array of char. Each row will contain a string. Make the number of columns large enough to accommodate the longest string plus one more for the null-terminator.

    And don't ever shout at us again.

IMN logo majestic logo threadwatch logo seochat tools logo