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
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 2 of 4.
R@M said:
1 decade ago
Relation between main function and called function is called "PROTOTYPE".
EX:- int add(int, int); /* Function prototype */
EX:- int add(int, int); /* Function prototype */
Pooja said:
5 years ago
I need a clear explanation about calling a function. I want to know the methodology behind it. Could anyone please tell me?
(1)
Santhosh kumar said:
1 decade ago
@Rathika
a=1
a++=1 //it increment the value after execute the exp
++a=3 //it increment the value before execute the exp
a=1
a++=1 //it increment the value after execute the exp
++a=3 //it increment the value before execute the exp
Amreen said:
7 years ago
I need a clear explanation about calling a function. I want to know the methodology behind it. Could you please tell me?
Kirti said:
6 years ago
Can anyone explain me. How to decide Which code part we have to write in main block and function block? Please tell me.
Vignesh said:
1 decade ago
Function prototyping is nothing but we are declaring that we have a function in a specific name to the compiler.
Tarun said:
1 decade ago
We cannot write two arguments in the return statements
ex:
return(x,y);
it will take only 3
ex:
return(x,y);
it will take only 3
Mahesh Kharvi said:
1 decade ago
0 is beside return because the function is integer type it should return integer value.
Kavya said:
10 years ago
Here value of a = 4, b = 3; then we are having calling function then a+b = 4+3 = 7.
(1)
Robot said:
1 decade ago
Tell me the difference between printf (predefined function) and return (keyword).
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers