 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can find out minimum and second minimum from an array by passing array into function. Before starting, you can note my information. You can follow or subscribe my YouTube channel through the link youtube.com slash sanjaygupta underscore tech school. You can download my programming app, Techimus, which is available on Google Play. Now I am going to implement a program in C, which will find out minimum and second minimum from an array and I have to pass array into function. So first I am including a header file, then I am declaring a function min s min. So it's written type is void and it will receive an argument of integer type. Sorry, it will receive an argument of integer type array. So this is function declaration. Then I am implementing main function, then printf statement, which will display the masses, enter 10 numbers on console to receive those 10 numbers. I am implementing for loop, which will repeat 10 times and it will repeat scan of statement. So all the elements will be stored inside a array using this foreign scanf. Now I am calling min s min function and I am passing array inside it. So this statement is function calling and then I am using return 0. Here return type of min s min function is void. So no values will be received here. So output will be displayed inside the definition of min s min function. So min s min function will be calculating two values minimum and second minimum. That's why return type of function is void because a function cannot return more than two values. So void min s min int a. So this is the block which will be known as function definition. Inside this block I am declaring a variable i min, which will be initialized by 32766 and s min 32767. These are the largest elements of integer range. Then for loop, which will repeat 10 times inside this loop, I am going to implement first if condition, which will check whether a of i is less than min. So if this condition is true, then I have to assign the current minimum into s min because the current minimum is lesser than a of i. So a of i will become new minimum. So the current minimum will be second minimum now. So s min equals to min and min equals to a of i. So I have assigned the current minimum into second minimum and a of i, which is the new minimum is assigned into min variable. If this condition is true, it means a of i is not less than min. It is greater than min. But now I can check whether a of i is less than s min or not. So if a of i is greater than min, but it is less than second minimum, then I have to check one more condition that a of i should not be equals to minimum. So now see this condition. If first if condition is false, it means a of i is greater than minimum, then else part will be evaluated. It is checking a of i is less than second minimum, but it should not be equals to minimum. So it means number is between min and second minimum. So it can be assigned into second min. So this way I have calculated both the values minimum and second minimum. After completion of loop, I can print the result on console using this print f. So minimum equals to percent d then slash n second minimum equals to percent d comma min comma s min. So this will print the result on console. So now the complete code is implemented. Here I have passed adding to function and function is calculating minimum and second minimum value, which is available inside. Now I am executing this code. You can see it is asking for 10 numbers. I am going to enter 10 values from one to end and it is printing the result minimum equals to one and second minimum equals to two. So the output is correct. The code is working properly. I hope you have understood the code well. If you want to watch more programming related videos, you can follow or subscribe my YouTube channel through the link youtube.com slash sanjaygupta underscore tax school. You can download my programming app Techimus, which is available on Google Play. Thank you for watching this video.