By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,419 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,419 IT Pros & Developers. It's quick & easy.

storing word from a file into 2d array

P: 16
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 lexicographically into another text file.I am not allowed to use string header for this.
any help would be appreciated
Oct 3 '06 #1
Share this Question
Share on Google+
1 Reply

P: 293
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.
Expand|Select|Wrap|Line Numbers
  1. for(int row = 0; row < NUM_ROWS; row++)
  2.    for(int col = 0; col < NUM_COLS; col++)
Oct 3 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.