int a = 0 and int a(0) differences
c++
Solution
`int a = 0;` and `int a(0);` make no difference in the machine generated code. They are the same.
Following is the assembly code generated in Visual Studio
int a = 10; // mov dword ptr [a],0Ah
int b(10); // mov dword ptr [b],0Ah
Problem
Possible Duplicate: Is there a difference in C++ between copy initialization and direct initialization? I just started to learn C++. To initialize a variable with a value, I came across ``` int a = 0; ``` and ``` int a(0); ``` This confuses me a lot. May I know which is the best way?