Published on : 2nd Oct 2021

Function in C programming
A function is a group of statements used to perform a well-defined task.
Function declaration :
return_type function_name(type1 arg1, type2 argr2, type3 arg3, ...., typen argn);
Function signature :
All the things present in function declaration except return type is function signature.
Function body :
return_type function_name(type1 arg1, type2 argr2, type3 arg3, ...., typen argn)
{
// statements
}
Function calling type :
- Call by value : when a value is passed to a function, the process is called call by value.
- Call by reference : when an address is passed to a function, the process is called call by reference.
Function arguments :
- Formal arguments : Arguments in function are called formal arguments.
- Actual arguments : Values passed at the time of function calling are called actual arguments.
Example :
#include <stdio.h> void func() { printf("Hi, I'm a function."); } int main(int argc, char** argv) { func(); return 0; }
Output :
Hi, I'm a function.