 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can pass structure as argument in function and how to return structure variable from function. Before starting, you can note how you can search my YouTube channel. You can type my name Sanjay Gupta in YouTube search bar. My channel will be available there. You can watch various programming related videos there. Now I am going to implement solution of this problem. So first I am including a header file that is a stdio.h. Now I am declaring a structure whose name is complex. It is having two members that are real and imaginary. Now I am going to declare a function. So here you can see return type of function is struct complex. Name of function is sum and I am going to pass two arguments in this function and both arguments will be of type struct complex. So this way I will be passing two structure arguments in some function and it will return a value which belongs to structure complex. So this statement is function declaration. Now I am going to define main function. Inside main function, I am going to declare three variables of structure C1, C2 and C3. Now to receive input from user, the masses enter first complex number will be displayed on output screen. Then scanf % % m% C1.real and m% C1.imaginary. So this way first complex number real and imaginary values will be received from user to receive second complex number from user printf and then scanf are written here. So this way C2.real and C2.imaginary will be received from user. So now I have received both the complex numbers from user. Now I can pass these C1 and C2 as an argument into the function sum. So I am calling sum function like this. So here you can see the statement is written C3 equals to sum C1, C2. So this statement is function call. Here C1 and C2 are passed as an argument and the result which will be returned from some function will be stored inside C3. Now I have to print the values of this C3 function on output screen. Sorry, this C3 variable on output screen. So for that purpose I am implementing if condition if C3.imaginary greater than equals to 0 then printf %d plus I %c3.real comma c3.imaginary. So this way complex number will be displayed if both real and imaginary are positive. Otherwise printf %d minus I %c3.real and minus c3.imaginary. So here I have used this negation sign because if imaginary value is negative then I have to print it in positive manner. So that's why I have used negative sign so that this imaginary value will be converted into positive number because I have printed minus I here. That will be representing that imaginary value is a negative number and at last I am writing return 0. So this is the complete code of main function. Now I have to define definition of some function. So its return type is struct complex name is some it is receiving two arguments. First one is stored inside C1 that is of struct complex type and second one is also stored into a structure type variable that is C2. Now I am going to declare a temporary structure variable that is T and I can receive results in T.real equals to C1.real plus C2.real then T.imaginary equals to C1.imaginary plus C2.imaginary. So this way addition will be stored inside T variable. Now I can return T structure variable through this return keyword. So this way I have implemented the some function definition which is receiving two arguments in C1, C2 variable in terms of structure variable and then addition is stored inside T variable. Then I have returned this T variable which will be received in main function at function calling statement into C3. Then C3 will be checked for imaginary value whether it is greater than or equals to 0 or less than 0 and accordingly results will be displayed on output screen. So this way I have implemented the concept where I have passed structure as an argument and I have returned structure variable from function. Now I am going to execute this code. Sorry, I have corrected the error. Now again I am executing this code. It is asking for first complex number. So I am entering 2 and 4. 2 is real value and 4 is imaginary. It is asking for second complex number. So I am entering 3 and 5. 3 as real value and 5 as imaginary. You can see the output 5 plus iota 9. So real values are 2 and 3. So that's why some is 5. Imaginary values are 4 and 5. So some is 9. So this way program is working properly. So I have implemented this code by passing structure variables into function and I have returned structure variable from function to the calling statement. So I hope you have understood how we can use structure variables in user defined functions. If you want to watch more programming related videos, you can search my name Sanjay Gupta in YouTube channel. My channel will be available there. You can watch various programming related videos there. Thank you for watching this video.