[clug-progsig] subroutines in C?
lost at l-w.ca
Sat Feb 26 18:02:35 PST 2005
Michael Walters wrote:
> Hello Shawn Grover and others in Progsig,
> I thought, would it not be neat to write some subroutines in C in a manner
> similar to subroutines in Fortran and Assembler?
> But there was no reference to subroutines in the index to "Absolute Beginner's
> Guide to C".
> Indeed, there was no reference to subroutines in the index of each of twelve
> of the thirteen books on C which I received from my cousin.
> There was a reference to subroutines in one C book in a chapter which dealt
> with interpretive languages like Basic.
> And in that chapter the text said that although there were no stand alone
> subroutines in Basic there was the gosub option.
> So does C not have an analogue to the subroutine as used in Fortran or
> I wanted to write some code that called on subroutines that I could write. Is
> this possible?
The analog to "subroutines" in C is a function that returns "void". Note
that you can also ignore the return value of functions that return other
types as well, although it would be a bad idea to ignore the return
value of "malloc()", for example.
finger lost at l-w.ca for further information
Geek Code V3.12: GCS/M/S d- s+:+ !a C++ UL++++$ P++ L+++ !E W++ !N w---
!D !M PS PE V-- Y+ PGP t+@ 5++ X !R tv+@ b+++@ !DI D? G e++ h+ y?
More information about the clug-progsig