 Hello friends. I am Sanjay Gupta. In this video, I am going to demonstrate you how you can count how many numbers are positive, negative and zero in a matrix by passing 2D array into a function. Before starting, you can note my information. You can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tax school. You can download my programming app TechMS which is available on Google Play. Now coming on to the topic here I will be implementing a code in C programming which will count how many positive, negative and zero elements are available in a matrix and I will be passing that matrix into function. So first I am including a header file that is stdio.h then I am declaring a function whose written type is void name of function is count and it will receive an argument that is 2D array of integer type. So this statement is function declaration. Then I am defining main function. Inside main function I am declaring a 2D array and two variables i and j. Now to receive elements I have to show a message enter elements on console. So this message will be displayed with the help of printf. Now to receive elements from user I am applying nested loops. So these nested loops will be reading values from user. So here I will be providing row index and j will be providing column index. And to read elements from user I am applying scanf statement. So scanf is responsible for reading elements from user and it will repeat with the help of these i and j loops. Now I am calling count function and I have passed a as an argument. So this statement is function calling and at last I am applying return zero. So now you can see I have implemented the complete main function which is reading 2D array and calling count function in which I have passed a 2D array as an argument. Now I am defining count function definition. So this block is function definition. Inside this function I am declaring some variables. So you can see C1, C2 and C3 all three variables are initialized with zero. So C1 will be counting positive quantities, C2 will be counting negative and C3 will be counting zero elements which are available in the matrix. So now I am applying nested loops again so that I can apply the logic. So here I will be providing row indexes and j will be providing column indexes. Now first condition is aij is greater than zero. So you can see if array element is greater than zero then it is positive. So I am incrementing C1. So C1 is counting positive quantity. If this condition is false then I am applying else if aij is less than zero. So if this condition is true then I am counting C2 plus plus. So this is counting negative quantity. So if number is negative then only C2 will be incremented by one and if this condition is also false then the number is zero. So I am applying C3 plus plus. So it is counting zero quantity. So this way I have implemented the logic in front of you. First condition is checking for positive quantity. Second is checking for negative and remaining elements will be automatically zero. So C1 is counting positive numbers, C2 is counting negative numbers and C3 is counting zero numbers which are available in the matrix. Now after completion of all these loops the elements which are available in the matrix are counted through C1, C2 and C3. So after completion of this loop I can print those quantities on console. So positive equals to percent D slash N negative equals to percent D slash N zero equals to percent D. Now C1 comma C2 comma C3. So with this printf all the elements which are available in C1, C2, C3 will be displayed on console. So this way I have implemented the complete code in front of you. Now I am executing this code. Here I am entering mixed type of values. Some are positive, some are negative and some are zero. So you can see the result. Positive equals to three, negative equals to two and zero equals to four. So if you see the matrix I have entered only three positive numbers that are one, four, four. Only two negative numbers that are minus three and minus five and four times I have entered zero. So this way program is working properly. It is showing the correct results on console. I hope you have understood how we can pass an array into a function and how we can count quantities of positive, negative and zero elements available in a matrix. If you want to watch more programming related videos you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tech school. You can download my programming app TechMS which is available on Google Play. Thank you for watching this video.