Subroutine , Basic Computer Science

Subroutine:  

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

1. (40 points) Add a course drop method to the system that you implemented in Problem Set 1. Modularize your new implementation properly. For any new methods that you introduce: 1.

Question 1 . Explain (a) Scatter loss                                (b) Aperture medium coupling loss Question 2 . What do you mean by Geo stationary orbit? Question

Advantages of Computerized Record-keeping Less manpower is required for upkeep.  Recording, storing, and retrieving are all much faster: easier and with little practice

difference between genral and event procedures

Question 1 What is a desktop? Explain the Windows XP desktop? 2 How does a flash drive work? 3 Write the procedure for creating Macro 4 Explain the process of applyin

Is IT a strategic weapon or a survival tool? Discuss.

Flowcharting: Flowcharting: A Flowchart is a graphical representation of an algorithm. It can be compared to the blueprint of a building. Just as a building contractor refers

Classification of Computers DIGITAL, ANALOG AND HYBRID Computers are of three basic types – Digital, Analog, and Hybrid. Current use of the word “computer” almost a

1. In each of the following situations, indicate whether f = O(g), or f = O(g), or both (in which case f = T(g)). Briefly explain why. (a) f(n)=10n5 +8n2,g(n)=20n4 +7n3 +300 (b) f