C | Functions | Question 7

Predict the output?

#include <stdio.h>
int main()
    void demo();
    void (*fun)();
    fun = demo;
    return 0;

void demo()
    printf("GeeksQuiz ");

(A) GeeksQuiz
(B) GeeksQuiz GeeksQuiz
(C) Compiler Error
(D) Blank Screen

Answer: (B)

Explanation: This is a simple program with function pointers. fun is assigned to point to demo. So the two statements “(*fun)();” and “fun();” mean the same thing.

Quiz of this Question

My Personal Notes arrow_drop_up

Practice Tags :
Article Tags :
Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

Recommended Posts:

0 Average Difficulty : 0/5.0
No votes yet.

User Actions