Skip to main content
GameDev.net gamedev.net
🔒 Locked

Matrix in Array (C language)

Started by cutting_edge Jul 14, 2004 at 4:57 AM 0 replies 650+ views
Original Post
cutting_edge
cutting_edge
Hola...I'm a 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] Thanx!!!! :-) :-)
ApochPiQ
ApochPiQ
Simple code for matrix addition:

double MatrixA[2][2], MatrixB[2][2], MatrixC[2][2];int i, j;// Put some values into MatrixA and MatrixBfor(i = 0; i < 2; i++) for(j = 0; j < 2; j++)  MatrixC[j] = MatrixA[j] + MatrixB[j];// MatrixC now contains the sum of A and B

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.