Matrix Addition
-
I want to add 2 matrices (2 dimensional), using 2 methods. 1. Pointer To Array Method 2. Base Address of Array Using Int Pointer Anyone please help me.
What is your trouble about? It's basic pointer handling...You know, proper pointer handling is required to access the real programmer initiation. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I want to add 2 matrices (2 dimensional), using 2 methods. 1. Pointer To Array Method 2. Base Address of Array Using Int Pointer Anyone please help me.
ratprita wrote:
I want to add 2 matrices (2 dimensional), using 2 methods.
Does this get you started:
void main( void )
{
int A[2][3] =
{
{0,1,2},
{9,8,7}
};int B\[2\]\[3\] = { {6,5,4}, {3,4,5} }; int C\[2\]\[3\]; for (int x = 0; x < 2; x++) { for (int y = 0; y < 3; y++) C\[x\]\[y\] = A\[x\]\[y\] + B\[x\]\[y\]; }
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
I want to add 2 matrices (2 dimensional), using 2 methods. 1. Pointer To Array Method 2. Base Address of Array Using Int Pointer Anyone please help me.
Newmat10 is a very powerful and neat library for matrix manipulation containing many useful functions. It might be helpful to you. Go to internet download it and try it!