Thread: return(array), 2 dimensional arrays to functions.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User nyekknyakk's Avatar
    Join Date
    Aug 2010
    Posts
    35
    Hi! So you're saying that i don't need to return a value anymore?
    What if my program runs like this:
    First, it asks the user for the matrices, then goes adds the matrices, then displays them.
    All those three, aking a matrix, adding a matrix and displaying a matrix, are different funcions.

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    You can just do:
    Code:
    // prototypes
    void read_matrix( int matrix_a[50][50], int matrix_b[50][50]);
    void add_matrix( int matrix_a[50][50] , int matrix_b[50][50], int result_matrix[50][50]);
    void display_matrix( int matrix[50][50] );
    
    // usage..
    read_matrix( mat_A,mat_B );
    add_matrix(mat_A,mat_B, result);
    display_matrix( result );

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array of functions
    By frktons in forum C Programming
    Replies: 29
    Last Post: 06-30-2010, 09:51 AM
  2. entry level homework help: Passing Arrays into functions.
    By DHart07 in forum C++ Programming
    Replies: 8
    Last Post: 04-21-2010, 09:11 AM
  3. functions and arrays
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 03-14-2002, 09:57 AM
  4. 2D arrays with functions made easy
    By goran in forum C Programming
    Replies: 1
    Last Post: 09-17-2001, 12:08 PM
  5. elements of arrays; functions
    By sballew in forum C Programming
    Replies: 6
    Last Post: 09-03-2001, 01:48 AM