C++ Programming Question: Download C++ Programming PDF

How do I initialize a pointer to a function?

Tweet Share WhatsApp

Answer:

This is the way to initialize
a pointer to a function
void fun(int a)
{

}

void main()
{
void (*fp)(int);
fp=fun;
fp(1);

}

Download C++ Programming PDF Read All 120 C++ Programming Questions
Previous QuestionNext Question
What does extern mean in a function declaration in C++?How do you link a C++ program to C functions?