-
Could someone...
tell me explanation of subprogams (function?) ? What it is, etc.
-
ATH0
A function is a group of commands (executed in sequence because you'd never use 'goto', right?).
It has to have four parts:
1) a return type
2) a name
3) a parameter list
4) a pair of { } containing said commands
Example:
void myfunction( void ) { puts("This is my function."); }
The return type is "void", meaning it actually doesn't return any values.
The name is "myfunction".
The parameter list is "( void )".
... more on this: you always have a ( ), but the items inside the ()
... may vary as you like
The body of the function contains:
{ puts("THis is my function."); }
The body of a function starts with the first { and ends with the corresponding }. This means that everything inside here belongs to this function and is processed by the call of this function.
To use this particular function, you'd just do:
myfunction( );
Quzah.
Popular pages
Recent additions