This document defines and explains functions in C programming. It states that a function is a block of code that performs a specific task and contains its own definition. There are two types of functions: predefined functions that are included in header files, and user-defined functions that are created by the user. User-defined functions can have no arguments with no return type, no arguments with a return type, arguments with no return type, or arguments with a return type. Arguments pass data values from the calling function to the called function. A function is called by another function and will only execute when called.
FUNCTION
What is function?
•A Function is a self contained block or a
separate block of a statements which are kept
together to perform a specific task in a
related manner.
• Every function must contain its definition as a
group of related statements to perform
specific task.
3.
FUNCTION CALL
• Alongwith the function definition function call
is also important.
• A function has no use without its function call.
• A function can be called by any other function.
• A function which calls any other function is
called as caller function and the function
which is being called is known as called
function.
PREDEFINED FUNCTION:-
• Theseare predefined function in c compiler
and their definitions are already available in
header file.
• Example- printf(), scanf(), pow().
• When ever we want to use these the function,
instead of writing the whole code we just
need to include the header file.
USER DEIFINE FUNCTION:-
• These are those function which are created by
user
6.
User define functionare of four type:-
1. No Argument No Return Type.
2. No Argument With Return Type.
3. With Argument No Return Type.
4. With Argument With Return Type.
WHAT ARE ARGUMENTS?
These are the data values which are passed from
the caller function to the called function.
TYPES OF ARGUMENTS:-
1. Actual Arguments.
2. Formal arguments
7.
HOW FUNCTION WORKS
•Statement in the function are not executed
until the function is called
• A function can be called by any other function.
• A function which is calling any other function
is known as caller function.
• A function which is being called is known as
called function