array of N pointers to functions returning pointers to functions

后端 未结 6 1629
时光说笑
时光说笑 2021-02-02 14:57

This was asked to me in an interview! i really got confused

  • How do I declare an array of N pointers to functions returning pointers to functions returning pointers
6条回答
  •  无人及你
    2021-02-02 15:23

    Divide big problem into smaller parts:

    /* char_func_ptr is pointer to function returning pointer to char */
    typedef char* (*char_func_ptr)();
    
    /* func_func_ptr is a pointer to function returning above type */
    typedef char_func_ptr (*func_func_ptr)();
    
    /* the_array is array of desired function pointers */
    func_func_ptr the_array[42];
    

提交回复
热议问题