C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - Find Output of Program (Q.No. 8)
8.
What is the output of the program
#include<stdio.h>
int main()
{
extern int fun(float);
int a;
a = fun(3.14);
printf("%d\n", a);
return 0;
}
int fun(int aa)
{
return (int)++aa;
}
Answer: Option
Explanation:
2 Errors
1. Type mismatch in redeclaration of fun
2. Type mismatch in parameter aa
1. Type mismatch in redeclaration of fun
2. Type mismatch in parameter aa
Discussion:
35 comments Page 4 of 4.
Sundar said:
1 decade ago
A small correction required.
int fun(int aa) --> int fun(floatt aa)
It will display 4 as output.
int fun(int aa) --> int fun(floatt aa)
It will display 4 as output.
Kavita.C.Karjagar said:
1 decade ago
Please write correct complete program because I want to compile.
Sundar said:
1 decade ago
In Turbo C it shows the following error:
Error PROGRAM.C 11: Type mismatch in redeclaration of 'fun'
In GCC (Linux) it shows the following errors:
Line 11: error: conflicting types for 'fun'
Line 4: error: previous declaration of 'fun' was here
Error PROGRAM.C 11: Type mismatch in redeclaration of 'fun'
In GCC (Linux) it shows the following errors:
Line 11: error: conflicting types for 'fun'
Line 4: error: previous declaration of 'fun' was here
Priyanka Gupta said:
1 decade ago
In this where type mismatch in redeclaration of function fun.
Shan said:
2 decades ago
Linker Error:undefined symbof fun(float)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers