Call function without parameter and parenthesis

后端 未结 3 1084
盖世英雄少女心
盖世英雄少女心 2020-12-11 05:25

In the following code snippet, the main function calls foo function without any parameter and parenthesis. It is strange that this code can be compiled by gcc. I actually ch

3条回答
  •  [愿得一人]
    2020-12-11 06:14

    The expression foo is evaluated (giving the address of the function), and the result is discarded. Without the () operator, the function isn't called.

提交回复
热议问题