Defining and accessing function
Gapfill exercise
Enter your answers in the gaps. When you have entered all the answers, click on the "Check" button.
What is function in C with example?
A
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
is a block of statements that performs a specific
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
. Let's say you are writing a C program and you need to perform a same task in that program more than once. In such case you have two options: a) Use the same set of
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
every time you want to perform the task
b) Create a
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
to perform that task, and just
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
it every time you need to
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
that task.
Why we need functions in C?
Functions are used because of following reasons –
a) To improve the
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
of code.
b) Improves the reusability of the code, same
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
can be used in any program rather than writing the same code from
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
.
c)
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
of the code would be easier if you use functions, as
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
are easy to be traced.
d) Reduces the
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
of the code, duplicate set of statements are replaced by function
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
.
How many types of functions are there in C?
There are
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
types of function in C programming:
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
library functions.
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
-
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
functions.
What is Predefined standard library function?
Standard library functions are also known as
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
-in functions.
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
such as puts(), gets(),
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
(), scanf() etc are
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
library functions. These functions are already
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
in header files (files with .h
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
are called
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
files such as stdio.h), so we just call them whenever there is a need to use them.
For example,
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
() function is defined in <
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
.h> header file so in order to use the printf() function, we need to include the
header file in our program using #include
.
What is User-defined function?
The
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
that we create in a
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
are known as user
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
functions or in other words you can say that a function
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
by user is known as user defined function.Syntax of a function
return_type
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
_name (
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
list)
{
Set of
argument
built
call
calls
created
Debugging
defined
errors
extensions
function
Functions
header
perform
printf
program
readability
scratch
size
Standard
statements
stdio
task
two
User
– Block of code
}
Check
OK