什么是int(a)(1)?这是一个有效的c ++语法吗? [英] what is int(a)(1)? is this a valid c++ syntax?
本文介绍了什么是int(a)(1)?这是一个有效的c ++语法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include <iostream>
int main()
{
------- some statements ---------
int(a)(1);
-------- some other statments .......
return 0;
}
我在C ++程序中看到这个语句。这不会导致语法错误。
I saw this statement in a C++ program. This did not result in a syntax error.
这里是 a
是什么?这是有效的C ++语法?
What is a
here? Is this valid C++ syntax?
推荐答案
可以把变量的名称放在括号中:
It is okay to put the name of the variable in parenthesis:
int i;
int (i); // exact same
所以在你的情况下:
int a(1); // initialized with 1
int (a)(1); // exact same
这篇关于什么是int(a)(1)?这是一个有效的c ++语法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文