In the second chapter we have discussed that when we execute a C program, the operating system calls the main() function of the program which marks the entry point for the execution.
USING
FUNCTIONS
In
the second chapter we have discussed that when we execute a C program, the
operating system calls the main() function
of the program which marks the entry point for the execution. When the program
is executed, the main () returns some
value to the operating system.
Any
function (including main()) can be
compared to a black box that takes in input, processes it, and then produces
the result. However, we may also have a function that does not take any inputs
at all, or the one that does not return anything at all.
While
using functions we will be using the following terminologies:
•
A function f that uses another function g
is known as the calling function and g is known as the called function.
•
The inputs that a function takes are known as arguments/ parameters.
•
When a called function returns some result back to the calling function, it is
said to return that result.
•
The calling function may or may not pass parameters
to the called function. If the called function accepts arguments, the calling
function will pass parameters, else it will not do so.
• Function declaration
is a declaration statement that identifies a function with its name, a list of
arguments that it accepts, and the type of data it returns.
• Function definition
consists of a function header that identifies the function, followed by the
body of the function containing the executable code for that function.
Programming in C: Unit III (a): Functions : Tag: : Programming in C - Using Functions
Programming in C
CS3251 2nd Semester CSE Dept 2021 | Regulation | 2nd Semester CSE Dept 2021 Regulation