VOOZH about

URL: https://www.geeksforgeeks.org/dsa/program-to-check-if-two-given-matrices-are-identical/

⇱ Program to check if two given matrices are identical - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Program to check if two given matrices are identical

Last Updated : 23 Jul, 2025

The below program checks if two square matrices of size 4*4 are identical or not. For any two matrices to be equal, a number of rows and columns in both the matrix should be equal and the corresponding elements should also be equal. 

Implementation:


Output
Matrices are identical

The program can be extended for rectangular matrices. The following post can be useful for extending this program. 
How to pass a 2D array as a parameter in C?

Time complexity: O(n2).
Auxiliary space: O(1).

Comment
Article Tags: