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 4 of 4.

Tanu said:   1 decade ago
How to work return function?

Niki said:   8 years ago
What is the protoype?

Gaurav kumar said:   8 years ago
Answer is 2, 2, 3.

Keerthana said:   1 decade ago
What is notation?

Kruthi said:   1 decade ago
How goto works?


Post your comments here:

Your comments will be displayed after verification.