• admin@embedclogic.com

User-defined Function in C

User-defined function as the name appears –“A function defined by a user/programmer”. these functions are not standard and these are the project-specific functions written by a programmer to make program modular and less complex.

Component of User-defined Function

There are three component in user-defined function –

— Function prototype declaration

— Function calling

— Function definition

use of three component in a program
Function prototype declaration

A function must be declared prior to its calling.The function declaration is an information for the compiler about the existence of a function in a program.


return_type function_name(input1_dataType,input2_dataType);

return_type = function output data type e.g int ,char,float,double etc.

input1_dataType , input2_dataType = Function’s arguments data type int ,char,float,double etc.

Function Calling

A function can be called from anywhere in the program with proper arguments as declared in the prototype.



Note: Type of data must be same as declared in the prototype of function for correct output.

Function definition

A function definition has the set of statements under its name to perform any specific task.


return_type function_name(dataType Input1,dataType Input2)






Write a function to perform addition of two integers.