Thread: Stuck again: Arrays

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    15

    Stuck again: Arrays

    I'm stuck, I can find how to change the value in a single-dimension array but not a multi-dimensional one.

    This, I know how to do:

    Code:
    example1[2] = 1;


    This, I can't figure out:

    Code:
    example1[1][2] = ????;


    How do I change the first value but not the second or vice versa?

    I know I'll probably do a Homer Simpson - "Doh!" if I get an answer.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by bliss
    This, I can't figure out:

    Code:
    example1[1][2] = ????;


    How do I change the first value but not the second or vice versa?
    That would change the value located at example1[1][2] which is one element, you can think of a 2 dimensional array as a grid.
    Code:
     0123
    0
    1
    2
    3

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    15
    "Doh!!"

    Makes sense now, thanks a bunch.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stuck, arrays
    By NoobieGecko in forum C Programming
    Replies: 26
    Last Post: 02-17-2008, 12:14 AM
  2. Replies: 16
    Last Post: 01-01-2008, 04:07 PM
  3. Need Help With 3 Parallel Arrays Selction Sort
    By slickwilly440 in forum C++ Programming
    Replies: 4
    Last Post: 11-19-2005, 10:47 PM
  4. Building B-Tree from Arrays
    By 0rion in forum C Programming
    Replies: 1
    Last Post: 04-09-2005, 02:34 AM
  5. Crazy memory problem with arrays
    By fusikon in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2003, 09:24 PM