Thread: Question about array

  1. #1
    Registered User
    Join Date
    Jul 2004

    Question about array

    Hola...I'm student majoring in Business..These days I just learned about C.. I Have a question, please u guys show me the source code..

    How to make a 2x2 array to create a matrix then perform additon and substraction of the matrices.(functions named addition and substraction)

    A=[ 2 3 ]
    [13 54]

    B= [4 10]
    [8 12]

    Last edited by cutting_edge; 07-14-2004 at 04:15 AM.

  2. #2
    Registered User
    Join Date
    Mar 2003
    This looks quite a lot like a homework, so I'd recommend that you give it a go yourself.
    Even if you mess it up, at least you've tried and we have something concrete we can help
    you with rather than just giving you the answer. As a start here's how to define the arrays:
    int main (void)
      int a[2][2] = {{2, 3}, {13, 54}};
      int b[2][2] = {{4, 10}, {8, 12}};
      int aminusb[2][2];
      int aplusb[2][2];
      /* add them up and subtract them (think about how you could use loops) */
      /* store results in aminusb and aplusb */
      /* print out results (again use loops if you can) */
      return 0;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamic Mutli dimensional Array question.
    By fatdunky in forum C Programming
    Replies: 6
    Last Post: 02-22-2006, 07:07 PM
  2. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. array question?
    By correlcj in forum C++ Programming
    Replies: 1
    Last Post: 11-08-2002, 06:27 PM