Home

functioncall

A function call is the act of invoking a function or method in a program. It transfers execution from the caller to the called function, supplies arguments, and, typically, returns a value to the caller. A function call may also be described as applying a function to a set of inputs.

When a call occurs, the language usually creates a new activation frame on the call stack to

Key concepts related to function calls include parameter passing mechanisms (such as pass-by-value, pass-by-reference, and pass-by-sharing),

Return values and side effects are central to the semantics of a call. A function may return

Optimizations may affect function calls, including inlining small calls or applying tail call optimization to reuse

hold
the
function’s
parameters,
local
variables,
and
the
return
address.
The
arguments
are
evaluated
(according
to
the
language’s
rules)
and
bound
to
the
function’s
parameters,
after
which
the
function
body
is
executed.
When
the
function
completes,
its
return
value
is
handed
back
to
the
caller
and
control
resumes
at
the
point
after
the
call.
Calls
can
produce
side
effects,
such
as
modifying
global
state
or
I/O.
default
and
variadic
arguments,
and
the
order
in
which
arguments
are
evaluated.
Some
languages
guarantee
a
specific
evaluation
order,
while
others
leave
order
unspecified.
a
value,
perform
actions
without
returning
a
value
(a
procedure),
or
raise
an
exception
on
error.
Calls
are
fundamental
to
programming
in
all
paradigms
and
support
patterns
such
as
recursion
and
higher-order
functions,
where
functions
are
passed
as
arguments
or
returned
as
results.
stack
frames
in
certain
languages.
The
details
of
function
calling
conventions
vary
by
language
and
runtime
but
the
basic
model—evaluate
arguments,
transfer
control,
and
obtain
a
result—remains
common.