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

write a c programme for add of two numbers with out use of arthematic operators

2 Answers  


write a program that print itself even if the source file is deleted?

2 Answers  


What does %d do?

0 Answers  


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

0 Answers   GrapeCity,


Write the following function in C. stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

4 Answers   OpenFeel,






extern static int i func() { i =10; i++; printf("%d \n",i); } main() { i =20; printf("%d \n",i); func(); printf("%d \n",i); }

2 Answers  


Explain what is output redirection?

0 Answers  


implement NAND gate logic in C code without using any bitwise operatior.

4 Answers   Alcatel,


what are two categories of clint-server application development ?

1 Answers  


What is the use of getch ()?

0 Answers  


What is context in c?

0 Answers  


which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....

2 Answers  


Categories