(redirected from Subroutines)
Also found in: Dictionary, Thesaurus, Medical.


a section of a computer program that is stored only once but can be used when required at several different points in the program, thus saving space



the part of a computer program that is used to solve similar-type problems. A subroutine usually describes a separate step in the computation process and can be used more than once in one or several different programs. Typical subroutines are used to compute elementary functions, such as sin x, In x, and e-x, to solve systems of equations, and to remove the results of computations in various forms. If it becomes necessary to use the subroutine during the running of the basic program, the subroutine is called at the appropriate place in the program, and after it has been run, control is transferred back to the main program. A subroutine can call on another.

A subroutine should have the following characteristics: it should be subject to standardized access rules that make it possible to call the subroutine from the main program by means of one or more instructions; it should be able to work with a broad range of initial data, for example, independent variables of a function; it should be relocatable, that is, it should be possible to place and run it in various parts of the computer memory. Subroutines are often arranged in subroutine libraries. So-called standard subroutines satisfying rigid conditions are used in automatic programming.

The use of subroutines is one way to save time and effort in writing computer programs. Subroutines form the basis of modular programming.


Lavrov, S. S. Vvedenie v programmirovanie. Moscow, 1973. (Bibliography.)



(computer science)
A body of computer instruction (and the associated constants and working-storage areas, if any) designed to be used by other routines to accomplish some particular purpose.
A statement in FORTRAN used to define the beginning of a closed subroutine (first definition).


(Or "procedure") A sequence of instructions for performing a particular task. Most programming languages, including most machine languages, allow the programmer to define subroutines. This allows the subroutine code to be called from multiple places, even from within itself (in which case it is called recursive). The programming language implementation takes care of returning control to (just after) the calling location, usually with the support of call and return instructions at machine language level.

Most languages also allow arguments to be passed to the subroutine, and one, or occasionally more, return values to be passed back.

A function is often very similar to a subroutine, the main difference being that it is called chiefly for its return value, rather than for any side effects.


A group of instructions that perform a specific task. A large subroutine might be called a "module" or "procedure." Subroutine is somewhat of a dated term, but it is still quite valid.
References in periodicals archive ?
Since compilers position subroutines in regular patterns and apply consistent alignment padding, the bytes preceding function entry points can improve recognition accuracy.
A potential mistake in acquisition planning is overlooking the fact that the subroutines and modules used to create applications and environments may either have a more individually unique scope or a broader scope than the application to which they belong.
Regarding the program, I will present below a sequence of the subroutine Compass_Get_Axes.
A subroutine for a welcoming message box, called Hello, would look like this:
The final line of code in the second subroutine (Listing #2, subroutine #2) of the Browser Form instructs the WebBrowser Control to navigate to the designated page, which appears in the window at run time.
Moreover, the Fortran 90 facilities for dynamic memory management greatly enhance the usability of the PSBLAS subroutines.
The nonmonotonicity property stems from the requirements on instructions for JVM subroutines.
The units also feature an automatic phase-alignment (phase peaking) subroutine that permits the user to simulate a signal that tests to controlled and repeatable peak power conditions.
NAG's Fortran Library has been available for many years and now consists of more than 1,200 user-callable subroutines for mathematical and statistical computations.
Using subroutines, processes are broken down into many small, independent flowcharts.
To the extent these subroutines can be stored and accessed through library mechanisms, they extend the base language for all programs of that language.
Sales manager Ken Heyse explains that Wittmann's previous CNC controller, which used a single microprocessor for all robot and peripheral functions, had to perform various subroutines sequentially, potentially interrupting the operation of the robot.