How do I store a function to a variable?

前端 未结 7 1889
灰色年华
灰色年华 2020-12-08 08:36

I think they are called functors? (it\'s been a while)

Basically, I want to store a pointer to a function in a variable, so I can specify what function I want to use

相关标签:
7条回答
  • 2020-12-08 09:06
    typedef unsigned int (*PGNSI)(unsigned int);
    
    PGNSI variable1 = func_1;
    PGNSI variable2 = func_2;
    
    0 讨论(0)
提交回复
热议问题