Skip to main content

Posts

Showing posts with the label example of function definition

Function definition in C programming

A function definition is a group of statements that is executed when it is called from some point of the program. The general syntax is return_type function_name (parameter1, parameter2, ....., parametern) { - - - - - statements ; - - - - - } Where, 􀂃 return_type is the data type specifier of data returned by the function. 􀂃 function_name is the identifier by which it will be possible to call the function. 􀂃 Parameters (as many as needed) : Each parameter consists of a data type specifier followed by an identifier like any regular variable declaration. (for eg: int x) and which acts within the function as a regular local variable. They allow to pass arguments to the function when it is called. The different parameters are separated by commas. 􀂃 Statements is the function’s body. It is a block of statements surrounded by braces{}. 􀂃 The first line of the function definition is k/a function header. #include<stdio.h> int addition (int a, in...