C Programming - Functions - Discussion

Discussion Forum : Functions - General Questions (Q.No. 1)
1.
The keyword used to transfer control from a function back to the calling function is
switch
goto
go back
return
Answer: Option
Explanation:

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

Example:


#include<stdio.h>
int add(int, int); /* Function prototype */

int main()
{
    int a = 4, b = 3, c;
    c = add(a, b);
    printf("c = %d\n", c);
    return 0;
}
int add(int a, int b)
{
/* returns the value and control back to main() function */
   return (a+b);
}

Output:
c = 7

Discussion:
35 comments Page 3 of 4.

Dipak said:   5 years ago
Can we put goto statement to transfer control out of function? Anyone tell me.
(1)

Vasavi said:   1 decade ago
Goto leads to an unconditional jump in the execution flow of a program's code.

Imran said:   7 years ago
I am not understanding the topic, so anyone help me to clear this topic.

Vinny said:   1 decade ago
What is difference between goto, return, go back and switch?

Balasubramanian.p said:   1 decade ago
What is return function? how to understant that easily?

Muniraja said:   8 years ago
Why to use return only condition is GOTO return value?

Sujatha said:   1 decade ago
What is prototype? Explain in detail please.

Jubliant.9 said:   9 years ago
What is prototype? Please describe it.
(1)

Mushtaq Ahmed said:   8 years ago
@Rathika.

The answer is 3,3,1.

Klp; said:   1 decade ago
Why 0 is there beside return ?


Post your comments here:

Your comments will be displayed after verification.