Which of the following is a correct way to declare a function pointer in C++? 

  • int func() 
  • int *func() 
  • int (*func)() 
  • int &func()
In C++, a function pointer points to the address of a function. The correct syntax for declaring a function pointer is type (*pointer_name) (parameter list). In the given options, int (*func)() is the correct way to declare a function pointer returning an int.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *