#include <iostream>
int main()
{
------- some statements ---------
int(a)(1);
-------- some other statments .......
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我在C++程序中看到了这个陈述.这不会导致语法错误.
这是什么a?这是有效的C++语法吗?
GMa*_*ckG 28
可以将变量的名称放在括号中:
int i;
int (i); // exact same
Run Code Online (Sandbox Code Playgroud)
所以在你的情况下:
int a(1); // initialized with 1
int (a)(1); // exact same
Run Code Online (Sandbox Code Playgroud)