C | Functions | Question 7
Predict the output?
#include <stdio.h>int main(){ void demo(); void (*fun)(); fun = demo; (*fun)(); fun(); 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
Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.



