Vidyalelo
C Programming · Q114

Pointer

Programming · C Programming · question 114

Q114

What will be the output of the following C code? #include int add(int a, int b) return a + b; int main() int (*fn_ptr)(int, int); fn_ptr = add; printf("The sum of two numbers is: %d", (int)fn_ptr(2, 3));

A.
Compile time error, declaration of a function inside main
B.
Compile time error, no definition of function fn_ptr
C.
Compile time error, illegal application of statement fn_ptr = add
D.
No Run time error, output is 5
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board