♦ C Function
♣ About C Functions
A Function is a method in which there are set of predefined statements which accepts some arguments and outputs a result.♣ C Functions Syntax
Below is the representation of C Functions Syntax.Basic Syntax
returnType functionName(inputArgument1, inputArgument2, ...){ // Body of Function return result; }
Syntax Explanation:
returnType: the data type of return value which produced post function processing inputArgument1, inputArgument2, ... : Input parameters which will be used inside function body // Body of Function: all of the code processing goes here result: calculated result is returned from this variable
♣ Example1: add Two numbers in C
In this example, a Function is used to add two numbers. Example
Input:
Output:
♣ Example2: Calculating factorial of number using Recursion in C
In this example, Factorial of a number is calculated by recursive method. Example
Input:
Output: