How can I return multiple values from a function?

Answers were Sorted based on User's Feedback



How can I return multiple values from a function?..

Answer / phani kumar s

by using the function call by reference with the multiple
returns

Is This Answer Correct ?    3 Yes 2 No

How can I return multiple values from a function?..

Answer / shruti

use of pointers.
call by refrance.

Is This Answer Correct ?    2 Yes 1 No

How can I return multiple values from a function?..

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

How can I return multiple values from a function?..

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

How can I return multiple values from a function?..

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

How can I return multiple values from a function?..

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

Post New Answer

More C Interview Questions

What is the difference between a string and an array?

0 Answers  


what is the difference between class and unio?

0 Answers   HCL, Wipro,


Write a pro-gramme to determine whether the number is even or odd?

1 Answers  


what is self refrential structure

3 Answers   HCL,


WAP to accept first name,middle name & last name of a student display its initials?

5 Answers   AITH, NIIT,






what is the answer for it main() { int i; clrscr(); printf("%d",&i)+1; scanf("%d",i)-1; }

3 Answers  


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

0 Answers   Infosys,


how to write optimum code to divide a 50 digit number with a 25 digit number??

0 Answers   MGM,


What is Generic pointer? What is the purpose of Generic pointer? Where it is used?

3 Answers  


How to write in a function declaration and in function call in which the function has 'n' number of varible or arguments?

2 Answers  


What is the difference between text files and binary files?

0 Answers  


What is #pragma statements?

0 Answers  


Categories