जॉइन Examsbookउत्तर :
What would be the output of the following program?
main()
{
extern int fun ( float );
int a;
a = fun ( 3. 14 );
printf ("%d", a);
}
int fun ( aa )
float aa ;
{
return ( (int) aa );
}5
प्र: What would be the output of the following program? main() { extern int fun ( float ); int a; a = fun ( 3. 14 ); printf ("%d", a); } int fun ( aa ) float aa ; { return ( (int) aa ); }
- उत्तर देखेंउत्तर छिपाएं
- Workspace
उत्तर :
व्याख्या :
Error occurs because we have mixed the ANSI prototype with K & R style of function definition. When we use ANSI prototype for a function and pass a float to the function it is promoted to a double. When the function accepts this double into a float a type mismatch occurs hence the error. The remedy for this error could be to define the function as : int fun (float aa) { .... }

