Thread: How to add my array size of 9 x 9 in it. THANKS!

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    38

    How to add my array size of 9 x 9 in it. THANKS!

    Take a look at the link i just posted.
    Attached Files Attached Files
    • File Type: c NC.c (638 Bytes, 148 views)

  2. #2
    Registered User camel-man's Avatar
    Join Date
    Jan 2011
    Location
    Under the moon
    Posts
    693
    I highly doubt anyone knows what you are trying to ask...

  3. #3
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    I'm afraid that the attached NC.c does nothing to elucidate your question

  4. #4
    Registered User
    Join Date
    Oct 2013
    Posts
    38
    Quote Originally Posted by SirPrattlepod View Post
    I'm afraid that the attached NC.c does nothing to elucidate your question

    Hey man. sorry for that. im doing some program on generating random numbers in an 2d array. i could put in the random numbers with loop. but i just dont know how to put an array of 9x9 into the code. I am stucked at where should i put it in. @@

    so sorry if any misunderstandings. Thanks.

  5. #5
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    posting-code-read-first: Announcements - General Programming Boards

    Whats the problem with array?

    Code:
    int arr[9][9];
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Why not use two for loops. Add a variable int r (for the row variable), and put it around the current for loop you have in the program, already.

    Code:
    for(r=0; etc.) {
       for(c=0; etc.) {
          //your random code in here
       }
    }
    That's not the only way to work with a 2D board, but it's the easiest way, imo.

  7. #7
    Registered User
    Join Date
    Oct 2013
    Posts
    38
    Yup. i solved it myself already. Thanks again!


  8. #8
    Registered User
    Join Date
    Oct 2013
    Posts
    38

    Help me!

    Why i get 10x9 instead of 9x9?
    And why my random numbers won't generate when i run the program the next time? the numbers appear the same in every array.


    thanks
    Attached Files Attached Files

  9. #9
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Why do you think you are getting 10x9, and why do you think the numbers are the same each time? I ran your code twice, and got two different 81x1 outputs.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. size of an array poited by array element
    By mitofik in forum C Programming
    Replies: 7
    Last Post: 12-24-2010, 12:09 AM
  2. How do I get the size of an array from a pointer to the array?
    By Programmer_P in forum C++ Programming
    Replies: 31
    Last Post: 06-03-2010, 04:13 PM
  3. size of array - why function gives size ONE only
    By noob123 in forum C++ Programming
    Replies: 7
    Last Post: 12-18-2009, 05:20 PM
  4. Finding Words in a array[size][size]
    By ^DJ_Link^ in forum C Programming
    Replies: 8
    Last Post: 03-08-2006, 03:51 PM
  5. Array Size
    By leonelmfreire in forum C Programming
    Replies: 6
    Last Post: 09-18-2005, 11:57 AM