Search



Saturday, 5 September 2015

functions theory

Functions can be called in 2 ways either with arguments or without arguments in C program. So, these functions may or may not return values to the calling function. So, the functions are divided into 4 categories listed below : -
  1. C function with arguments (parameters) and with return value
  2. C function with arguments (parameters) and without return value
  3. C function without arguments (parameters) and without return value
  4. C function without arguments (parameters) and with return value
S.noC functionsyntax
1with arguments and with
return values
int function ( int );         // function declaration
function ( a );                // function call
int function( int a )       // function definition
{statements;  return a;}
2with arguments and without
return values
void function ( int );     // function declaration
function( a );                // function call
void function( int a )   // function definition
{statements;}
3without arguments and without
return values
void function();             // function declaration
function();                     // function call
void function()              // function definition
{statements;}
4without arguments and with
return values
int function ( );             // function declaration
function ( );                  // function call
int function( )               // function definition
{statements;  return a;}

No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.