 Hello friends, I am Sanjay Gupta. I welcome you on my channel. You can watch various programming related videos here. My channel contains more than 800 videos. You can search those videos with the help of keyword programming by Sanjay Gupta. In this video, I am going to demonstrate how to return values from functions in C programming. For this purpose, I am going to use the example how to calculate factorial of a number. So first of all, I am going to include a header file stdi.h. Now I am going to declare a function whose name is fact. Its return type is int and it will receive an argument that will be of integer type and this complete statement is known as declaration. So this first word int will be known as return type here. So this function will be receiving one argument of int type and this function will be returning a value that will be also of type integer. After this declaration, I am going to define main function where I will be calling this function. So first of all, I am going to receive a number from user with the help of printf and scanf. So these are very simple functions. You might have used these functions in every C program to print something or to receive values from user. Now here I am going to call the function fact. So this is calling of function and this calling will be receiving a particular value inside f variable. So that will be printed on output screen with the help of printf. So result equals to person d and f. So this way the returned value will be stored inside f variable at line number 10 and at line number 11, it will be displayed on output screen. So this is the complete definition of main function. After defining main function, I am going to define definition of fact. So this block will be known as function definition. So this way, total d parts, declaration, calling and definition are available in this program. Now I am going to define definition of factorial or you can say the process or logic through which we can calculate factorial. Here I am going to implement a loop which will calculate factorial. The result will be stored inside f variable. So after calculation, I am going to return value of f. So this return f will return the value at calling statement. So line number 19 will be returning value of f that will be received through a variable f which is available at line number 10. So main function is calling fact function passing a variable and into definition of fact function. So definition is available at line number 13 to line number 20. So this definition will be returning a value back to main function and main will be printing that value on output screen at line number 11. So this way, we are passing one number to a particular function and that function is returning calculated result result to the main function back. So this way you can pass a value to a function and you can return value through that function back to the calling statement. Now I am going to execute this code. I am entering five as input. You can see the result is 120. So factorial of five is 120. So this program is working properly. I hope you have understood how we can pass and return values from function in C programming. If you want to watch more programming related videos, you can follow my YouTube channel. Don't forget to subscribe it. Thank you for watching this video.