Discussion :: Functions - True / False Questions (Q.No.2)
Functions cannot return more than one value at a time
Answer: Option A
True, A function cannot return more than one value at a time. because after returning a value the control is given back to calling function.
|Nitish said: (Sep 5, 2010)|
|But if we use call by reference method in which original values are passed then a function can return more than 1 value at a time.
void areaperi(int,float *,float *);
printf("\nEnter radius of a circle");
printf("\n Area=%f \n Perimeter=%f,area,perimeter");
void areaperi(int r, float *a, float *p)
|Sagar said: (Oct 13, 2013)|
|Yup @Nitish, you are right. That's what I wanna say. A function can return multiple values by using call by reference. A mixed call containing call by value and call by reference can do it also.|
|Santhosh said: (Jul 7, 2015)|
|Then what is the answer? They didn't update it.|
|Nandyvijay said: (Jul 21, 2016)|
|Can anyone give the correct explanation for this?|
|Akshat said: (Sep 12, 2016)|
|It can only return 1 value. We are not directly getting two values by using call by reference, we have nowhere used return statement two times. Therefore function can only return 1 value.|
|Harika said: (Oct 10, 2016)|
|Usually function returns only one value, but using structures we can return more than one value.|
|Vinay said: (Jul 23, 2017)|
|We can also return multiple values at the time of return.
Such as return(2,3);
|Anita said: (Aug 30, 2017)|
|According to me, it is possible to return more than one value in a function by making use of pointers.|
|Saumya said: (Sep 12, 2017)|
|Yes, Function can return more than one values at a time. We can do this using pointer. Like *Sum = a;.|
|Kranthi said: (Aug 20, 2020)|
It returns 3 only.
we will get k=3 only.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.