storing word from a file into 2d array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hello12
    New Member
    • Oct 2006
    • 16

    storing word from a file into 2d array

    hello,
    i am having trouble storing word from a text file into a 2d array in C. the array size is 20 by 20 and i am required to store one word in each row. For some reason i don't get how to use a nested for loop to switch to next row after reading the first word.
    This program is for sorting the words lexicographical ly into another text file.I am not allowed to use string header for this.
    any help would be appreciated
    thanks
  • D_C
    Contributor
    • Jun 2006
    • 293

    #2
    I'm not sure exactly how you mean to traverse the array, an example would have helped. I assume you want to go across one row, then across the next row, until the last row.
    Code:
    for(int row = 0; row < NUM_ROWS; row++)
       for(int col = 0; col < NUM_COLS; col++)

    Comment

    Working...