What will happened ,if the subprogram is called second time?

Showing Answers 1 - 5 of 5 Answers

Saradha

  • Oct 13th, 2005
 

Subprogram are reusable statements. If more than one program require the same statements to be repeated, then its better idea to place these statements in a new program and CALL them as subprograms. The result vary as what value u pass as parameter

They can be called as many time as the programmer wishes. These subprogram will be expanded in the main memory while execution. Thus main program space is reduced and its easy to understand the logic.

Note: Here 'St' is short for Statement. Let suppose that St2 is having 100 lines of repeatable code.

Say: ProgA is having St1,  St2 , St3,  St2. And ProgB is having St5, St2, St6. And ProgC is having St7, St2.

If u Observe St2 is repeated in DIFFRENT programs (ProgA/B/C) as well as WITHIN SAME prog (ProgA). So its better to place the St2 in a subprogram and then make a CALL to this SUBPROGRAM. 

You can pass same/different parameters each time you make a CALL to the subprogram, even within SAME program. 

  Was this answer useful?  Yes

GZ

  • Apr 2nd, 2006
 

variables might already be in initiated state due to first run.

  Was this answer useful?  Yes

Mahaveer

  • Feb 2nd, 2014
 

Code Program-idIS INITIAL PROGRAM
If IS INITIAL is coded along with program id of of sub program then the program will be in intial stage every time it is called
OR CANCEL is issued after CALL will set the sub program to initial state

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions