Sum of two matrices using two dimensional array in C

Matrix is the perfect example of a two-dimensional array. It has row and column. A row represents one dimension and column represents the second dimension. For example matrix[4][5], it has 4 rows, each row consisting 5 elements i.e matrix[0] has 5 elements, matrix[1] has 5 elements and so on. In this example, two matrices are added and the result is displayed. Addition is done with corresponding elements of individual matrix i.e. matrix1[0][0] is added with matrix2[0][0].
The complete source code and output are given here….(The code is also available on GitHub). Here are related articles about matrix operation.

  1. Multiplication of Two Matrices in C

Source Code

 

matrix
Output

The above program allocates the fixed memory to store the matrix. The program below shows the dynamic memory allocation to allocates the memory to store the matrix.

SHARE Sum of two matrices using two dimensional array in C

You may also like...

7 Responses

  1. Thanks nice set of programs for beginners

  2. Nice
    I like it very much sir

  3. Nice
    I like it very much sir

  4. nice
    it is very easy to understand.
    thank u.. sir

  5. how can i write an algorithm for this problem ??? may i know sir

  6. Anonymous says:

    crystal clear

Leave a Reply

Your email address will not be published. Required fields are marked *

Share