The keyword used to transfer control from a function back to the calling function is?

By Anjnee Bhatnagar|Updated : June 23rd, 2022

The keyword used to transfer control from a function back to the calling function is?

  1. switch
  2. goto
  3. go back
  4. return

Answer:

Option D. return keyword is used to transfer the control from a function back to the calling function.

Solution:

The keyword used to transfer control from a function back to the calling function is “return”. Options A, B, and C cannot be the answer as the switch keyword is used in control statements. The goto keyword creates ambiguity in the code. Therefore, it is avoided by the programmers, and there exists no keyword such as “go back” in C or C++.

Comments

write a comment

Follow us for latest updates