UMBC CS 201, Fall 98
Procedures in C
We sometimes use the term procedure to
refer to a function that does not return a value.
This is probably more for historic reasons, since some languages like
Pascal and FORTRAN, make this distinction to be an important one.
Why bother to call a function if it isn't going to return a value?
For its side effects, of course.
Here's a good example
void GiveInstructions(void)
{
printf(....);
printf(...);
printf(...);
return;
}
Why make this into a separate procedure
... rather than just include the printf's directly in the calling
function?
- You may want to call it from several places within your
program.
- It will make the calling programs more
readable to do so. (And hence easier to understand, thus
easier to maintain.)
CSEE
|
201
|
201 F'98
|
lectures
|
news
|
help
Last Modified - Tuesday, 22-Sep-1998 19:12:50 EDT