how to return a multiple value from a function?

Answers were Sorted based on User's Feedback



how to return a multiple value from a function?..

Answer / yogesh

#include<stdio.h>
#define PI 3.1415
int main()
{
double area,perimeter,radius;
printf("Enter radius of Circle:");
scanf("%lf",$radius);
calculate(&area,&perimeter,radius);
printf("Area of Circle:%lf\nPerimeter of
Circle:%lf",area,perimeter);
}
calculate(double *a,double *p,double r)
{
*a=PI*r*r;
*p=2*PI*r;
}

Is This Answer Correct ?    3 Yes 0 No

how to return a multiple value from a function?..

Answer / chandu

using call by refernce

Is This Answer Correct ?    4 Yes 2 No

how to return a multiple value from a function?..

Answer / shruti

use call by refrance..-> pointers.

Is This Answer Correct ?    0 Yes 1 No

how to return a multiple value from a function?..

Answer / ara

string f()
{
return "a multiple value";
}

:) if this a trick question ...

Is This Answer Correct ?    1 Yes 4 No

how to return a multiple value from a function?..

Answer / vinayakkatkar

using if else statement
for example
int fun()
{
if(cond1)
return var1;
else
return var2;

}

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More C Code Interview Questions

main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }

1 Answers  


void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


program to find the roots of a quadratic equation

14 Answers   College School Exams Tests, Engineering, HP, IIIT, Infosys, Rajiv Gandhi University of Knowledge Technologies RGUKT, SSC,


main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 Answers  


#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

1 Answers  






#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }

2 Answers  


1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?

2 Answers  


how can i cast a char type array to an int type array

2 Answers  


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  


write a program in c to merge two array

2 Answers  


main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024

2 Answers   HCL,


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


Categories