What is meant by return type? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is meant by return type?

18th Mar 2016, 4:19 AM
Adele Lawal
Adele Lawal - avatar
3 Answers
+ 4
The data type that the function should return after its execution is called 'return type' of the function. For example, consider this function declaration: int Sum(int, int); In this function, I can use 'return' keyword to return any 'int' type variable from the function. When the 'return' happens, the function execution ends and the code flow is redirected back to the calling function. Example code with function definition:: int main() { int result = Sum(22, 13); return 0; } int Sum(int a, int b) { return a+b; } Here 'main' (calling function) calls the function 'Sum' by passing two 'int' parameters '22' and '13'. The function uses 'return' to pass back the sum of two passed parameters. This returned type is stored into 'result' in the main function after execution of 'Sum'. Thus 'int' type is returned from the function. It is NOT necessary to use the 'result' to call the Sum function. The 'int' type will be returned from 'Sum' unconditionally. Its the user's c
21st May 2016, 3:54 AM
Alok Bhat
+ 1
Return Type means Function will going to return Which kind of value.
15th Jun 2016, 6:37 AM
Kunal Hirani
Kunal Hirani - avatar
0
return type means which type of value is return by the function it can bt void int float etc it returns the value to the calling function
8th Aug 2016, 9:16 PM
sachin tomar
sachin tomar - avatar