# Check Sparse Matrix C Program

## C Program To Check Sparse Matrix using Arrays

Learn How To Find if a Matrix is a Sparse Matrix or not in C Programming Language. This C code to check for sparse matrices makes use of Arrays. However, a sparse matrix can also be represented in data structures using Linked Lists as well.

#### What is a Sparse Matrix?

A sparse matrix is a multi-dimensional array which consists of higher number of Zero elements. In other words, a sparse matrix has lower number of non zero elements as compared to elements with zero as its value. There are different algorithms used for storing sparse matrices. We have used static arrays for creating sparse matrices in the following code.

0  1  0
0  0  1
1  0  0

#### Output

In case you get any compilation errors or any doubts in this C Program To Check if a Matrix is Sparse or Not, let us know about it in the Comment Section below.

Recommended Programs
C Program To Find Sum of Rows and Columns of Matrix
C Program For Stack using Linked List Implementation
C Program For DES Encryption Algorithm
C Program To Implement Singly Linked List
C Program To Sort Array in Descending Order
C Program For Binary Search Algorithm using Function
C Program To Generate Random Numbers
C Program To Find Symmetric Matrix
C Program To Check Skew Symmetric Matrix
C Program To Implement Chain Matrix Multiplication Algorithm

#### Tushar Soni

I am Tushar Soni, Co - Founder of CodingAlpha. I am a computer science student from India and passionate about Web Development and Programming. Connect with me on Facebook | LinkedIn | Google Plus

### 2 thoughts on “Check Sparse Matrix C Program”

• December 22, 2016 at 10:44 pm

Or we also can use else statement aftter if(matrix[i][j]==0)
Zero_count=Zero_count+1;
else
temp++;

Then we doesnot have to find the row*col/2;

And also got the number of non zero number in the matrix