0
3.6kviews
what is Re-entrant and Recursive procedure/subroutine
1 Answer
1
246views

Procedure :

  • The repeated group of instructions in a large program can be written separately from the main program.

  • This subprogram is called as Procedure in an assembly language programming, i.e. Procedure is a set of statements that can be processed independently from the main program.

Syntax:

PROC PROCEDURENAME

PROCEDURENAME ENDP

Example:

PROC Addition

.. Addition logic..

Addition ENDP

Advantages of Procedure:

  1. Simplify and reduce the amount of repetitive coding.

  2. Reduces errors caused by repetitive coding.

  3. Makes program more readable.

  4. Execution time is less as compare to procedure as no extra instructions are required.

Reentrant Procedure:

The procedure which can be interrupted, used and "reentered" without losing or writing over anything is called re-entrant procedure.

In some situation it may happen that procedurel is called from main program procedure2 is called from procedure is again called from procedure2. In this situation program execution flow reenters in theprocedure1. These types of procedures are called reentrant procedures.

2

Recursive procedure

A recursive procedure is a procedure which calls itself. Recursive procedures are used to work withcomplex data structure called trees. If the procedure is called with N (recursion depth) = 3. Then the n is decremented by one after cach procedure is called until n=0. 1

Please log in to add an answer.