I was trying some different ways of initializing variables.
int a(0);
cout<<a;
for this code segment output is 0 .
in another way, I initialize a with 0
int a= int();
cout<<a;
output: 0
then I try this:
int a(int());
cout<<a;
this time output is 1
actually what does the value the int() function return ? 0 or 1
I think that your last attempt (
int a(int())) is an example of the "most vexing parse". Thus,ais a function, not an int.This:
Yields:
And putting this result here gives: