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
What is virtual memory? How address mapping is done in cache memory? Elaborate your answer with examples.

TRANSMISSION MEDIA: When we speak of transmission media, we usually mean a mix of physical lines ranging from wire pairs to cable, and over the air transmission media, such as

defferentiat hardware and software and gave example

What constitutes ERP? ERP typically comprises a client server architecture, fourth generation language, RDBMS and graphical user interface in an open systems environment. It

Memory hierarchy: There is another type of high speed memory, known as Cache memory, which is used to increase the speed of processing by making current programs and data avai

Input/Output Services:   Every operating system, large or small, provides input/output services for each device in the system. The operating system includes I/O device driver

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

Block diagram of digital computer: The general pattern of computer architecture has remained unchanged over the last four decades or so. It has a single processor, which accep

what is the logic diagram for the Boolean expression x''y + xy'' + xz

No charges are reimbursed to the patient until the deductible has been met. Hospital visits are reimbursed at 80% and Lab visits are reimbursed at 70%. Doctor''s office visits are