Reputation: 4284
#include <iostream>
int main()
{
// ------- some statements ---------
int(a)(1);
// -------- some other statements .......
return 0;
}
I saw this statement in a C++ program. This did not result in a syntax error.
What is a
here? Is this valid C++ syntax?
Upvotes: 19
Views: 4050
Reputation: 504103
It is okay to put the name of the variable in parenthesis:
int i;
int (i); // exact same
So in your case:
int a(1); // initialized with 1
int (a)(1); // exact same
Upvotes: 29