Help with 2d Int Arrays

This is a discussion on Help with 2d Int Arrays within the C Programming forums, part of the General Programming Boards category; Need some help guys; just started working with C and I'm having some issues with arrays. I'm working on making ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    3

    Help with 2d Int Arrays

    Need some help guys; just started working with C and I'm having some issues with arrays. I'm working on making a program to solve the 8-queens problem. I have a function that has a 2d int array passed to it that it uses to calculate elimination values. I want to store these elimination values in another 2d array to be used later. I can't declare an array as a return type like I could in java. So, how would I go about exporting this array?

    Could I pass another parameter, like a pointer to another array outside the function? I don't know much about pointers at all (our professor has just started on the subject).

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,451
    Quote Originally Posted by Voondebah View Post
    Need some help guys; just started working with C and I'm having some issues with arrays. I'm working on making a program to solve the 8-queens problem. I have a function that has a 2d int array passed to it that it uses to calculate elimination values. I want to store these elimination values in another 2d array to be used later. I can't declare an array as a return type like I could in java. So, how would I go about exporting this array?

    Could I pass another parameter, like a pointer to another array outside the function? I don't know much about pointers at all (our professor has just started on the subject).
    you can pass the second array as a parameter the same way you pass the first array
    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
    Feb 2009
    Posts
    3
    Wow, I feel silly now. I think I've been just working on the problem too long and overlooked that possibility. Thanks so much, I feel rejuvenated!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 10-27-2006, 01:21 PM
  2. Game Won't Compile
    By jothesmo in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2006, 03:24 PM
  3. Replies: 2
    Last Post: 03-24-2006, 07:36 PM
  4. Converted from Dev-C++ 4 to Dev-C++ 5
    By Wraithan in forum C++ Programming
    Replies: 8
    Last Post: 12-03-2005, 06:45 AM
  5. 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

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