Sunday, December 10, 2017

What is a function declaration in c language programing

Function⇋ declaration

A function is a group of statements that together perform a task. Every C program has at least one function, which is main() , and all the most trivial programs can define additional functions.

               A function declaration is the part of is responsible for instructing the compiler on the function name.
                                 The return type as well as the function parameters and the function body is actually derived form the function definition.

For example:-

/* function returning the max between

int max ( int num1 , int num2 ) {

/* local variable declaration */
int result ;

if ( num3> num4)

result = num3 ;

result = num4 ;

return result ;


There are define a generally type of c- program function declaration :-

Return -type ; function -name ; parameter -list ; & function body.

  • Return type 
  • Function name
  • Parameters
  • Function body

return type function:-

It is a anticipated that a function will we return a value. And it actually may now that value is of a certain data type. That data type is what we refer to as return type function.
                         Some functions perform the desired operations without returning a value. In this case, the return_type is the keyword void .

 This is a exact function name and the parameter listed  together constitute of the function signature.

First of all you need to realize that you do not have to work with parameter when it comes to function in c programing  language.
            The parameter list refers to the type, order, and number of the parameters of a function. Parameters are optional; that is, a function may contain no parameters.

Function body:-
When it comes to the function body you will find in it is an assembly of statement defining what is the actual function.

For example:-

#include <stdio.h>

/* function declaration */
int max ( int num2 , int num3);
int main () {
/* local variable definition */
int x= 200;
int y= 300
int ret ;
/* calling a function to get max v
ret = max ( x , y); printf ( "Max value is : %d\n" , re
return 0 ;


They are the some example of the function declaration & types.


Please comment and follow this site blog inbox