Open In App
Related Articles

C | Functions | Question 7

Improve Article
Improve
Save Article
Save
Like Article
Like

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

Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads