ABL electronic PIC12 Personal Computer User Manual


 
Function Calls
A function is called with actual arguments placed in the same sequence as their
matching formal parameters. Use a function-call operator ():
function_name
(
expression_1
, ... ,
expression_n
)
Each expression in the function call is an actual argument. Number and types of
actual arguments should match those of formal function parameters. If types dis-
agree, implicit type conversions rules apply. Actual arguments can be of any com-
plexity, but you should not depend on their order of evaluation, because it is not
specified.
Upon function call, all formal parameters are created as local objects initialized by
values of actual arguments. Upon return from a function, temporary object is cre-
ated in the place of the call, and it is initialized by the expression of
return state-
ment. This means that function call as an operand in complex expression is treated
as the function result.
If the function is without result (type
void) or you don’t need the result, you can
write the function call as a self-contained expression.
In C, scalar parameters are always passed to function by value. A function can
modify the values of its formal parameters, but this has no effect on the actual
arguments in the calling routine. You can pass scalar object by the address by
declaring a formal parameter to be a pointer. Then, use the indirection operator
*
to access the pointed object.
Argument Conversions
When a function prototype has not been previously declared, mikroC converts
integral arguments to a function call according to the integral widening (expan-
sion) rules described in Standard Conversions. When a function prototype is in
scope, mikroC converts the given argument to the type of the declared parameter
as if by assignment.
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
98
MikroElektronika:
Development
tools
-
Books
-
Compilers
page