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;
}
3
3.14
4
Compile Error
Answer: Option
Explanation:
2 Errors
1. Type mismatch in redeclaration of fun
2. Type mismatch in parameter aa
Discussion:
35 comments Page 3 of 4.

Naveen said:   1 decade ago
There is no need of explicit typecasting because the return type is int.

Suman said:   1 decade ago
Can anyone explain this statement: return (int)++aa in this program ?

Hemanthkumar said:   1 decade ago
This word "mismatch" I am really fed up of this can any one explain?

Kavita.C.Karjagar said:   1 decade ago
Please write correct complete program because I want to compile.

Priyanka Gupta said:   1 decade ago
In this where type mismatch in redeclaration of function fun.

Abinaya said:   10 years ago
I too don't understand the 2nd error. Please explain me.

Sri said:   1 decade ago
Can any one explain this program? I can't understand.

Suresh said:   1 decade ago
This concept I cannot understand how is possible?

Ravi said:   3 years ago
@Lakshmi.

Yes, you are correct it can be ++a;.

Shan said:   2 decades ago
Linker Error:undefined symbof fun(float)


Post your comments here:

Your comments will be displayed after verification.