Subroutine , Basic Computer Science

Assignment Help:

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    


Related Discussions:- Subroutine

Unix, How do I change file permissions? Every time I execute chmod commands...

How do I change file permissions? Every time I execute chmod commands it tells me permission denied.

Database design, Build a database application for a sports league. Assume y...

Build a database application for a sports league. Assume your application is to keep track of teams and equipment that is checked out to teams. Explain the steps that is needed and

Explain the raster scan display system, Question 1 Explain boundary fill a...

Question 1 Explain boundary fill and flood fill polygon filling algorithm Question 2 Draw and explain the block diagram of typical workstation Question 3 Explain the ras

Time sharing, Time Sharing Time sharing allows a large number of users ...

Time Sharing Time sharing allows a large number of users at various remote terminals to simultaneously use a centrally located computer for problem solving. Each user operates

Objectives of laboratory organisation and management, Objectives When y...

Objectives When you have completed all the work in this unit you should be able to: List the basic components of a personal computer system, 1. describe the use of comput

Kirchhoff’s law, A car battery is of 12 V. Eight dry cells of 1.5 V each ...

A car battery is of 12 V. Eight dry cells of 1.5 V each connected in series can give 12 V. But such cells are not used in starting a car. Why?

Access time - storage devices, Access time: Access time: This is the t...

Access time: Access time: This is the time required to locate and retrieve stored data from the storage unit in response to a program instruction. That is the time interval be

Digital to analogue conversion (dac), Digital to analogue conversion (dac):...

Digital to analogue conversion (dac): Since many systems used on aircraft will require outputs in analogue form, it will be necessary to be able to convert the digital informat

Define jumps and loops , The unconditional jumps in a written program in a...

The unconditional jumps in a written program in assembler language are specified by the jmp instruction; a jump is to moves the flow of the execution of a program by sending the co

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd