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
Question 1 List the Basic essential components of a computer network Question 2 What are the functions of (i) Routers (ii) Bridges Question 3 What are the advantag

Question 1 Discuss on "Platform as a Service" Question 2 Write a note on Accounting Services Question 3 Explain the different Software clients Question 4 D

QUESTION (a) Write a program to swap two names between two variables for examples: N1 = "Mary Anne" N2 = "Queen Mary". The program should make use of an appropriate Fu

Ask question #WHAT IS TWO BUS STRUCTURE

1. The standard way for debuggers to plant breakpoints in a program in RAM (whatever the processor instruction set) is to save the breakpointed instruction and replace it by a jump


Operating Systems: The operating system is the software that mediates between the applications programs and a level of instructions nearer to the machine's operations. In othe


Define opportunity cost The opportunity cost of any commodity is defined as the cost of next best alternative, which has been sacrificed for producing the given commodity. Th

The system bus is a cable which carries data communication among the major components of the computer, as well as the microprocessor. Not all of the communication that uses the bus