FUNCTION
Same task in repetition What is FUNCTION ? It is self contain block of statement that perform Same task in repetition
Collection of Function creates a C FUNCTION contains set of instructions enclosed by “{ }” which perform specific operation in c program. C Program Function Collection of Function creates a C Program
Uses :- FUNCTION Avoid rewriting same logic/code again & again No limit in calling function to make use of it We can call functions any no. of times & from any place in a program Dividing a big task into small pieces Function have re-usability FUNCTION
Function Declaration :- Return_type function_name(argument list); This informs complier about Function name , Function parameters and return value’s data type
This call the actual function Function call :- Function_name (argument list); This call the actual function
Output
Types of FUNCTION FUNCTION Library Function User Defined Function
How to call FUNCTION in a program ? Call by value Call by reference
All FUNCTION can be called either with arguments or without arguments in c program . And also these Function may or may not return value to the calling function.
FUNCTION with no argument & no return value FUNCTION with argument & no return value FUNCTION with argument & with return value
FUNCTION with no argument & no return value
Output
FUNCTION with argument & no return value
Output
FUNCTION with argument & with return value
Output