| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Sub |
RM> I can't refer to a part that is not before the one I'm
RM> presently in
RM> how can I do what I want....
This might help...
*** CREATING FUNCTIONS AND PROTOTYPES IN C ***
To create new functions in C, you only need to write them.
They consist of two parts.
1. a prototype
2. a codeblock
A prototype defines the function and its parameters.
It consists of a return data type, a function name, and the
arguments expected by the function.
int func(int variable)
{
/* code block */
return int_value;
}
A prototype for the function must appear in the code prior to any
usage of the function by the code. The function itself may appear
prior to any call to itself, or a separate prototype may exist
apart from the actual prototype which accompanies the code block.
This prototype does not require variable names for arguments, but
allows them. Only variable types are actually required here.
These prototypes take a form similar to other variable declaration
statements, and are, indeed, such. They even require a semi-colon.
They define a pointer to the function.
int func(int);
These pototypes must match the ones accompanying the function, as
far as return variable type, function name, and argument variable
type are concerned. These prototypes may appear outside of any
functions, allowing all subsequent code to access the function
thus prototyped, or they may be placed only in those functions
by which the given function is to be called.
In such cases, they may only appear at the beginning of a code
block, following the same rules as other variable types.
The code block may be whatever is necessary to implement the
purpose of the function, but must return a variable consistant
with the return value defined in the prototype.
Where no return values or arguments are required, a variable
type void should be used.
void func(void)
{
/* code block */
}
Prototypes for the standard libraries are contained in the .H
files for those libraries. They are grouped by function and
utility. The string handling functions being prototyped in the
file, etc...
*** end CREATING FUNCTIONS AND PROTOTYPES IN C ***
> ] * Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 SEEN-BY: 639/252 670/213 218 @PATH: 154/750 222 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.