Below is the source code
Code:
#include<stdio.h>
#include<conio.h>
int main(void);
float * Display(float *,float *);
int main(void)
{
float a,b,*c;
clrscr();
printf("Enter two real numbers\n");
scanf("%f%f",&a,&b);
c=Display(&a,&b);
printf("The addition is %f",*c);
getch();
return 0;
}
float * Display(float *a,float *b)
{
float c;
c=*a+*b;
return(&c);
}
The above progarm is not giving proper output while executing.
Output:
Enter two real numbers
2.3
3.5
The addition is -NAN
I am using Turbo C++ Compiler v3.0
Plz let me know how exactly the code is.
Thanks