104
Compiler
© 2008 Conrad Electronic
{
return a-
10
;
}
The return value is within the function stated as instruction "return Expression". If there is a function
of the void type then the return instruction can be used without parameters in order to leave the
function.
References
Since it is not possible to pass on arrays as parameters the access to parameters is possible
through references. For this a pair of brackets is written after the parameter names in the parameter
declaration of a function.
int StringLength(char str[])
{
int i;
i=
0
;
while(str[i]) i++;
// repeat character as long as unequal zero
return(i);
}
void main(void)
{
int len;
char text[
15
];
text=
"hello world"
;
len=StringLength(text);
}
In main the reference of text is presented as parameters to the function StringLength. If in a function
a normal parameter is changed then the change is not visible outside this function. With references
this is different. Through parameter str in StringLength the contents of text can be changed since str
is only the reference (pointer) to the array variable text.
Presently arrays can only be passed "by Reference"!
5.2.8
Tabellen
5.2.8.1
Operator Precedence
Rang
Operator
13
( )
12
++ --
! ~ -
(negatives Vorzeichen)
11
* / %
10
+ -
Содержание C-Control Pro Mega Series
Страница 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Страница 9: ...VIII Inhalt 2008 Conrad Electronic ...
Страница 10: ...Part 1 ...
Страница 17: ...Part 2 ...
Страница 23: ...Part 3 ...
Страница 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Страница 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Страница 58: ...Part 4 ...
Страница 91: ...82 IDE 2008 Conrad Electronic ...
Страница 92: ...Part 5 ...
Страница 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Страница 136: ...Part 6 ...
Страница 231: ...Part 7 ...
Страница 240: ......