Simple question about arrays

This is a discussion on Simple question about arrays within the C Programming forums, part of the General Programming Boards category; See, I've got a 2 dimensional array, let's call it "myarray" for simplicity. myarray is 8 on 8 (myarray[8][8]). Now ...

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    5

    Simple question about arrays

    See, I've got a 2 dimensional array, let's call it "myarray" for simplicity.
    myarray is 8 on 8 (myarray[8][8]).

    Now assuming I want to put an 8 bit word in myarray[0][0-7].
    Is there any way I can put it whole? Like " myarray[0]=10100110; " ?
    That doesn't compile, but that's just an example.
    I'd think there'd be a way to put it together, and not one by one, but I can't seem to find it.
    Do I really to change each "tile" on its own?

    Thanks, tima.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    Code:
    int myarray[8][8]={{1,0,1,0,0,1,1,0}};
    all members left not initialized during declaration will be initialized to 0 (if at least one member of the array was initialized explicitely.
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    5
    Quote Originally Posted by vart View Post
    Code:
    int myarray[8][8]={{1,0,1,0,0,1,1,0}};
    all members left not initialized during declaration will be initialized to 0 (if at least one member of the array was initialized explicitely.
    I don't want to set it during declaration, because the array changes according to what I type.
    I want to do it in the middle of the code.

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    Quote Originally Posted by tima View Post
    I don't want to set it during declaration, because the array changes according to what I type.
    I want to do it in the middle of the code.
    Then you need to write a loop
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 01-30-2009, 04:58 AM
  2. Simple question about the C programming tutorial #1
    By elsheepo in forum C Programming
    Replies: 13
    Last Post: 01-19-2009, 07:59 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Question on Arrays
    By shin in forum C Programming
    Replies: 10
    Last Post: 06-06-2004, 01:11 PM
  5. simple input and string manipulation question
    By Stig in forum C Programming
    Replies: 1
    Last Post: 12-15-2001, 12:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21