answersLogoWhite

0

It depends what language you are using. Structured languages provide the easiest method, simply call the function containing your subroutine and control will automatically return to the point of the call when the function ends. You can even use functions to return a value to the caller. If functions are not an option, the language might provide a gosub statement. This is similar to a goto statement but returns control to the caller, much like a function would in a structured language.

User Avatar

Wiki User

9y ago

What else can I help you with?

Continue Learning about Engineering

Explain goto and return in c?

A return statement is used to transfer the program control flow to the function that has called the current function under execution. If the function is main, then the program returns the control flow to the operating system. The syntax for return statement is:return return-type;A goto statement is used to transfer the control flow to a particular labelled statement, not necessarily back to the calling program. There are somerestrictionson using a goto statement. For eg: the goto statement should not skip any variable declarations. The use of goto statement is usually considered as a bad programming practice. The syntax for goto statement is:goto label_name;....label_name: statements;


What are the various control statement in C language?

Control statements are the statements that control the flow of program execution. For eg: loops: For, While, Do-While, decision making using if-then-else or switch-case and there's goto to transfer control.


What is flow control statement used in C programming?

Flow control statements are those statements that cause execution to branch or jump to a new section of code, often upon evaluation of some conditional expression (a decision statement such as an if or switch statement). The break, continue, goto and return statements are all flow-control statements. Function calls are not considered to be flow control statements since functions can be inline expanded (by the compiler) and would therefore follow the normal flow of execution.


What statement is used to skip the remainder of the body of a repetition structure and proceed with the next iteration of the loop?

The continue statement skips the remaining statements in the current iteration and execution proceeds with the iteration control statement for the next iteration.


What are the methods available to return control to the caller in c language?

A subroutine or function call will return control to the caller when either the end of the enclosing block is encountered, or via a 'return' statement. This is the standard method of returning control; there are other ways, such as through exceptions and other techniques, but they aren't standard or common.

Related Questions

What are subroutine linkages?

The Mechanism that makes possible to transfer control between the calling program and Subroutine is reffered to as SUBROUTINE LINKAGE


What is the call instruction?

The call instruction is an assembly language command used to invoke a subroutine or function within a program. When executed, it saves the address of the next instruction (the return point) onto the stack and transfers control to the specified subroutine. After the subroutine completes its execution, a return instruction (often "ret") is used to pop the return address from the stack and resume execution at that point. This mechanism allows for modular programming and code reuse.


Explain goto and return in c?

A return statement is used to transfer the program control flow to the function that has called the current function under execution. If the function is main, then the program returns the control flow to the operating system. The syntax for return statement is:return return-type;A goto statement is used to transfer the control flow to a particular labelled statement, not necessarily back to the calling program. There are somerestrictionson using a goto statement. For eg: the goto statement should not skip any variable declarations. The use of goto statement is usually considered as a bad programming practice. The syntax for goto statement is:goto label_name;....label_name: statements;


How can I programmatically stop the execution of a MATLAB program?

To programmatically stop the execution of a MATLAB program, you can use the "return" statement or the "error" function to exit the program at a specific point. This will halt the execution and return control to the calling function.


What does CALL 06FA in 8085 mean?

In the 8085 microprocessor, the instruction CALL 06FA is used to call a subroutine located at the memory address 06FA. When this instruction is executed, the current program counter (PC) value is pushed onto the stack, and the PC is then updated to 06FA, allowing the microprocessor to execute the subroutine at that address. This enables structured programming by allowing the main program to temporarily transfer control to a subroutine and return afterward.


What are the various control statement in C language?

Control statements are the statements that control the flow of program execution. For eg: loops: For, While, Do-While, decision making using if-then-else or switch-case and there's goto to transfer control.


What is flow control statement used in C programming?

Flow control statements are those statements that cause execution to branch or jump to a new section of code, often upon evaluation of some conditional expression (a decision statement such as an if or switch statement). The break, continue, goto and return statements are all flow-control statements. Function calls are not considered to be flow control statements since functions can be inline expanded (by the compiler) and would therefore follow the normal flow of execution.


What statement is used to skip the remainder of the body of a repetition structure and proceed with the next iteration of the loop?

The continue statement skips the remaining statements in the current iteration and execution proceeds with the iteration control statement for the next iteration.


What are the methods available to return control to the caller in c language?

A subroutine or function call will return control to the caller when either the end of the enclosing block is encountered, or via a 'return' statement. This is the standard method of returning control; there are other ways, such as through exceptions and other techniques, but they aren't standard or common.


During execution of what PR task units regain control of IP and transfer physical custody to the reintegration team?

Report


What is return means in programming?

A return statement exits the function in which it is declared and gives control to the calling code. Returning from the main function exits the program and gives control to the execution environment.


Control statement in c plus plus?

Control statements are statements that alter the flow of execution according to the evaluation of an expression (the condition). The C++ control statements are ifstatements, switch statements and the tertiary conditional operator, ?:.