Thread: Passing the variable as a Reference

  1. #1
    Unregistered
    Guest

    Passing the variable as a Reference

    I'm trying to pass variables as a reference, but I have no idea how to pass two-dimensonal arrays.

    Let's s say we have a char name [2][6], and an int num[1][2] how would I pass'em to an Input fuction to assign values by reference and then send them to a print function (by reference)? They have to be declared in main.

  2. #2
    Unregistered
    Guest
    you can try something like this:

    //includes

    //function definition
    void foo(int array**);

    int main()
    {
    //array declaration
    int array[2][2];

    //function call
    foo(array);

    //manipulate array

    return 0;
    }

    //function declaration here

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing structure by reference or pointer?
    By 7force in forum C Programming
    Replies: 8
    Last Post: 12-13-2010, 06:49 PM
  2. passing struct vs. reference
    By reakinator in forum C Programming
    Replies: 4
    Last Post: 06-14-2008, 10:11 PM
  3. How to: Use OpenGL with Jgrasp
    By Pickels in forum Game Programming
    Replies: 3
    Last Post: 08-30-2005, 10:37 AM
  4. passing by address vs passing by reference
    By lambs4 in forum C++ Programming
    Replies: 16
    Last Post: 01-09-2003, 01:25 AM
  5. Variable Allocation in a simple operating system
    By awkeller in forum C Programming
    Replies: 1
    Last Post: 12-08-2001, 02:26 PM