0

I have a simple question: how to give a function pointer a initial value, of kind of void..

typedef void (*FunctionPointer)();
FunctionPointer func; //how to init here
..... (func var may or may not be assigned a value here)
func() 

So I want variable func to have an initial value, something like func = void() How can I achieve this? Thanks.

leppie
  • 115,091
  • 17
  • 196
  • 297
Maluvel
  • 425
  • 1
  • 6
  • 13

1 Answers1

0

Variables declared outside of any function already get initialized, you don't have to do anything.

If it is inside a function, then

FunctionPointer func = 0;
M.M
  • 138,810
  • 21
  • 208
  • 365