Subroutine , Basic Computer Science


A subroutine  is a type of subprogram, a piece of code within a larger program that performs a specific task and is relatively independent of the remaining code.  It is also called a procedure, routine or a method.  A subroutine has no value associated with its name. All outputs are defined in terms of arguments; there may be any number of outputs. 

 In most cases, a subroutine needs some information about the circumstances in which it has been called. A procedure that performs repeated or shared tasks uses different information for each call. This information consists of variables, constants, and expressions that you pass to the procedure when you call it.

  A parameter represents a value that the procedure expects you to supply when you call it. You can create a procedure with no parameters, one parameter, or more than one. The part of the procedure definition that specifies the parameters is called the parameter list. 

 An argument represents the value you supply to a procedure parameter when you call the procedure. The calling code supplies the arguments when it calls the procedure. The part of the procedure call that specifies the arguments is called the argument list. For example here is a subroutine to find the sum of three numbers    

Posted Date: 10/23/2012 3:58:31 AM | Location : United States

Related Discussions:- Subroutine , Assignment Help, Ask Question on Subroutine , Get Answer, Expert's Help, Subroutine Discussions

Write discussion on Subroutine
Your posts are moderated
Related Questions
A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Write an ARM subroutine which will extract a substring from a string. You will need to use the library routine malloc to allocate memory for the new string. The subroutine signatu

Server Programs:   Server programs are dedicated computer programs that run as services and serve the needs or requests of other programs. These services may run on a dedicated

Round robin (RR) is one of the simplest, oldest, fairest and most extensively used algorithms. • In the round robin scheduling, processes are posted in a FIFO manner but are given

Coaxial Cables: Another metallic transmission medium which offers a large bandwidth, is the coaxial cable. Such cables consist of an outer protective shell made of copper tube

explain how modern computers conform to john von nuemann''s architeture?

Different kinds of registers are general between most microprocessor designs. These are: Program Counter (PC) This register is utilized to hold the memory address of the next instr

evolution of oop

Networks: There are different interpretations for the term °nets% The Oxford English Dictionary states that 'a network is an interconnected chain or system of immaterial thing