Search your topic here

Fundamentals of sub-programs

FUNDAMENTALS OF SUBPROGRAMS


General characteristics for all subprograms except co-routines:
  • Each subprogram has a single entry point.
  • The calling program unit is suspended during the execution of the called subprogram.
  • Only one subprogram remain in execution at any given time.
  • Control always returns to the caller subprogram when the called subprogram execution terminates.
Basic definitions:
  • A subprogram call is the explicit request that a specific subprogram be executed.
  • A active subprogram is which is in execution.
  • A subprogram header, which is the first part of the definition, provides name, type and parameters for subprogram. For example, int show(int a){  }.
  • The parameter profile of a subprogram contains the number, order, and types of its formal parameters.
  • The protocol of a subprogram is its parameter plus, its return type (if function).
  • The parameters in the subprogram header are called formal parameters.
  • Values passed in called subprograms parameters is called actual parameters.
  • The first actual parameter is bound to the first formal parameter and so forth. Such parameters are called positional parameters.

LEAVE A REPLY










Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.