Short Notes: Function Categories | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE) PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


FUNCTION CATAGORIES
There are four main categories of the functions these are as follows:
1. Function with no arguments and no return values.
2. Function with no arguments and a return value.
3. Function with arguments and no return values.
4. Function with arguments and return values.
Function with no arguments and no return values:
syntax:
void funct (void); 
main ()
{
funct ( );
}
void funct ( void);
{
}
NOTE: There is no communication between calling and called function. Functions are
executed independently, they read data & print result in same block.
Example:
void link (void) ; 
int main ()
{
link ();
}
void link ( void );
{
printf (“ link the file “ )
}
Page 2


FUNCTION CATAGORIES
There are four main categories of the functions these are as follows:
1. Function with no arguments and no return values.
2. Function with no arguments and a return value.
3. Function with arguments and no return values.
4. Function with arguments and return values.
Function with no arguments and no return values:
syntax:
void funct (void); 
main ()
{
funct ( );
}
void funct ( void);
{
}
NOTE: There is no communication between calling and called function. Functions are
executed independently, they read data & print result in same block.
Example:
void link (void) ; 
int main ()
{
link ();
}
void link ( void );
{
printf (“ link the file “ )
}
Function with no arguments and a return value: This type of functions has no arguments but 
a return value
example:
int msg (void) ; 
int main ()
{
int s = msg ( );
p rin tf “ summation = %d”, s);
}
int msg ( void)
{
int a, b, sum ; 
sum = a+b ; 
return (sum) ;
}
NOTE: Here called function is independent, it read the value from the keyboard, initialize and 
return a value .Both calling and called function are partly communicated with each other.
Function with arguments and no return values:
Here functions have arguments so, calling function send data to called function but called 
function does no return value. such functions are partly dependent on calling function and result 
obtained is utilized by called function .
Example:
void msg ( int, int); 
int main ()
{
int a,b;
Page 3


FUNCTION CATAGORIES
There are four main categories of the functions these are as follows:
1. Function with no arguments and no return values.
2. Function with no arguments and a return value.
3. Function with arguments and no return values.
4. Function with arguments and return values.
Function with no arguments and no return values:
syntax:
void funct (void); 
main ()
{
funct ( );
}
void funct ( void);
{
}
NOTE: There is no communication between calling and called function. Functions are
executed independently, they read data & print result in same block.
Example:
void link (void) ; 
int main ()
{
link ();
}
void link ( void );
{
printf (“ link the file “ )
}
Function with no arguments and a return value: This type of functions has no arguments but 
a return value
example:
int msg (void) ; 
int main ()
{
int s = msg ( );
p rin tf “ summation = %d”, s);
}
int msg ( void)
{
int a, b, sum ; 
sum = a+b ; 
return (sum) ;
}
NOTE: Here called function is independent, it read the value from the keyboard, initialize and 
return a value .Both calling and called function are partly communicated with each other.
Function with arguments and no return values:
Here functions have arguments so, calling function send data to called function but called 
function does no return value. such functions are partly dependent on calling function and result 
obtained is utilized by called function .
Example:
void msg ( int, int); 
int main ()
{
int a,b;
a= 2; b=3;
msg( a, b);
}
void msg ( int a , int b)
{
int s ;
sum = a+b;
printf (“ sum = %d”, s ) ;
}
Function with arguments and return value:
Here calling function of arguments that passed to the called function and called function 
return value to calling function.
example:
int msg ( int, int) ; 
int main ()
{
int a, b;
a= 2; b=3;
Page 4


FUNCTION CATAGORIES
There are four main categories of the functions these are as follows:
1. Function with no arguments and no return values.
2. Function with no arguments and a return value.
3. Function with arguments and no return values.
4. Function with arguments and return values.
Function with no arguments and no return values:
syntax:
void funct (void); 
main ()
{
funct ( );
}
void funct ( void);
{
}
NOTE: There is no communication between calling and called function. Functions are
executed independently, they read data & print result in same block.
Example:
void link (void) ; 
int main ()
{
link ();
}
void link ( void );
{
printf (“ link the file “ )
}
Function with no arguments and a return value: This type of functions has no arguments but 
a return value
example:
int msg (void) ; 
int main ()
{
int s = msg ( );
p rin tf “ summation = %d”, s);
}
int msg ( void)
{
int a, b, sum ; 
sum = a+b ; 
return (sum) ;
}
NOTE: Here called function is independent, it read the value from the keyboard, initialize and 
return a value .Both calling and called function are partly communicated with each other.
Function with arguments and no return values:
Here functions have arguments so, calling function send data to called function but called 
function does no return value. such functions are partly dependent on calling function and result 
obtained is utilized by called function .
Example:
void msg ( int, int); 
int main ()
{
int a,b;
a= 2; b=3;
msg( a, b);
}
void msg ( int a , int b)
{
int s ;
sum = a+b;
printf (“ sum = %d”, s ) ;
}
Function with arguments and return value:
Here calling function of arguments that passed to the called function and called function 
return value to calling function.
example:
int msg ( int, int) ; 
int main ()
{
int a, b;
a= 2; b=3;
int s = msg (a, b);
printf (“ sum = %d”, s ) ; 
}
int msg( int a , int b)
{
int sum ;
sum =a+b ; 
return (sum);
}
Read More
90 docs

Top Courses for Computer Science Engineering (CSE)

Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Objective type Questions

,

Previous Year Questions with Solutions

,

Sample Paper

,

Summary

,

Extra Questions

,

Short Notes: Function Categories | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

video lectures

,

Short Notes: Function Categories | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

past year papers

,

MCQs

,

Viva Questions

,

Free

,

shortcuts and tricks

,

pdf

,

Exam

,

Semester Notes

,

mock tests for examination

,

ppt

,

Important questions

,

Short Notes: Function Categories | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

practice quizzes

,

study material

;