I think it's a basic question, but I canīt find the answer anywhere.
What's the difference between:
int x(5);
and
int x=5;
Thanks.
I think it's a basic question, but I canīt find the answer anywhere.
What's the difference between:
int x(5);
and
int x=5;
Thanks.
Where did you find int x(5)? int x=5 is a definition where x is initialized to 5.
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition
The former demonstrates direct initialisation while the latter demonstrates copy initialisation. For objects of built-in types, there is effectively no difference, but for objects of class types copy initialisation would not be allowed if the respective constructor is declared explicit.Originally Posted by AndresF
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Thank you very much, thatīs just what I wanted to know