Thread: Two-dimensional array

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    16

    Exclamation Two-dimensional array

    yo yo
    Last edited by BamaMarine06; 03-01-2010 at 03:28 AM.

  2. #2
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    Code:
    for( i = 0; i < NUM_STUDENTS; i++)
       for( j = 0; j < NUM_TESTS; j++)
          grades[i][j] = value;
    Here i is the row of the two dimensional array "grades".
    j is the column of the grades array

    The above code snippet will describe an idea about storing the values in a two dimensional array.
    Last edited by thillai_selvan; 03-01-2010 at 12:55 AM.

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    16
    So, do i define NUM_STUDENTS before int main(void)?

  4. #4
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    Yeah.!!!
    Sample:
    Code:
    #define NUM_STUDENTS 100
    #define NUM_TESTS 5

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    16
    Store each word as a row of a char array, making sure a null character is stored at the end of each word so it can be treated as a string (up to 30 words with 20 chars each should be sufficient, no need to check for going past the end). "This would be defined as...................................#define NUM_LETTERS 20
    #define NUM_WORDS 30, correct?

  6. #6
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    Yeah. Great!!

  7. #7
    Registered User
    Join Date
    Mar 2010
    Posts
    16
    Thank you so much. Brand new to this and am completely lost. Read the textbook and took tutorial but not understanding.

  8. #8
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    Welcome Bama...
    I suggest you to go through the following URL which lets u get familiar with two dimensional arrays.

    TWO-DIMENSIONAL ARRAYS.

  9. #9
    Registered User
    Join Date
    Mar 2010
    Posts
    16
    This is outstanding!!!!! Ya'll are some real good people in here looking out for us "Newbies". Thankx, also real quick. Got a link for a newbie that cannot understand c programming. A place that would baby step me through it? I did the tutorial son cprogramming but still not connecting.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  2. two dimensional array
    By leisiminger in forum C Programming
    Replies: 12
    Last Post: 03-09-2008, 11:53 PM
  3. Type and nontype parameters w/overloading
    By Mr_LJ in forum C++ Programming
    Replies: 3
    Last Post: 01-02-2004, 01:01 AM
  4. Replies: 5
    Last Post: 11-20-2001, 12:48 PM