Function Call by Returning Value in C Programming

When a function returns value of variables then that function is known as ‘function call by returning values.’

Syntax:

// Declaration
<data_type> <function_name>();

// Calls
<variable_of_function>=<function_nm>();

// Definition
<data_type><function_name>()
{
	<function_body>;
	- - - - - - - -;
	return <variable_of_function>;
}

Program :

/* Program to demonstrate function call by returning value.
Creation Date : 24 Nov 2010 12:18:56 AM
Author : www.technoexam.com [Technowell, Sangli] */

#include <stdio.h>
#include <conio.h>

int number()
{
	int no;
	printf("\n Enter Number : ");
	scanf("%d",&no);
	return no;
}
int main(void)
{
	int no;
	int number();
	clrscr();
	no = number();
	printf("\n Number is : %d",no);
	getch();
	return 0;
}

Output :

 Enter Number : 5
 
 Number is : 5_

Leave A Comment

Your email address will not be published. Required fields are marked *