What is the difference between following initialization
int ivar1;
int ivar2=int();
Printable View
What is the difference between following initialization
int ivar1;
int ivar2=int();
hello,
In the first case, int ivar1, you are declaring the variable, by which you are telling the compiler about the type and size of variable.But you are not defining that variable.
But in the second case, You are declaring and defining the variable ivar2 in the same line. So the return value of the func. int() will be stored in to variable ivar2. While defining only compiler will allocate the memory for the variable.