how to return a multiple value from a function?
Answers were Sorted based on User's Feedback
#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 |
Answer / ara
string f()
{
return "a multiple value";
}
:) if this a trick question ...
| Is This Answer Correct ? | 1 Yes | 4 No |
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 |
#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d----%d",*p,*q); }
how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.
19 Answers Cap Gemini, Infosys,
Who could write how to find a prime number in dynamic array?
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }
how to check whether a linked list is circular.
given integer number,write a program that displays the number as follows: First line :all digits second line : all except the first digit . . . . Last line : the last digit
void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }
#include<stdio.h> int main() { int x=2,y; y=++x*x++*++x; printf("%d",y); } Output for this program is 64. can you explain how this output is come??
how to concatenate the two strings
How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.
program to Reverse a linked list
12 Answers Aricent, Microsoft, Ness Technologies,
Design an implement of the inputs functions for event mode