How can I return multiple values from a function?
Answers were Sorted based on User's Feedback
Answer / phani kumar s
by using the function call by reference with the multiple
returns
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / vignesh1988i
we can indirectly return multiple values from a function through pointers......
what ever you make the alterations in the sub-routine since pointers refer to address the value will be directly gets changed in the actual address
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / suman halder
1.we can apply "call by reference" mechanism within the
function so that multiple values get returned..
2.if the return types are homogeneous..i.e if we wanna return more than one integer values or more than one characters or any other type,then we can use an array to do that job for us as C provides various ways to return array from a function ..
*** if u try to return more than one value at a time through return statement ,last value will be returned and
all other values are ignored..
e.g
return 10,20,30;
it will only return 30
so,the most convenient way to do this is to use "call by reference" mechanism..
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kr swamy naidu
make finction return type as a structure or array so that you can return multiple values
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / phani kumar
if we want to retrive multiple values from functions
derive multiple arguments in the defition of functions
| Is This Answer Correct ? | 0 Yes | 2 No |
What is binary tree in c?
Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
how do you redirect stdout value from a program to a file?
How do I use void main?
Given an array of characters, how would you reverse it? How would you reverse it without using indexing in the array?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
is assignment operator is arithmatic or not
Can you return null in c?
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
Explain what is gets() function?
write a program that finds the factorial of a number using recursion?