RE: What is difference between followin intialization....
in first case a variable will be create in memeory with the default base type value (depending upon compiler 2 compiler) bcoz it is not initialized. in second case the variable will be created in the memory with the value retuned by the function int() (if int is a user define function) the second statement should have been int *i new int();
RE: What is difference between followin intialization....
Preeti Yadav is right Ivar1 is not initialized but in the second case compiler initilizes the Ivar2 to sero. create a console program and use COUT to print Ivar1 and Ivar2 and observe that Ivar1 prints junk value and Ivar2 value will be zero
RE: What is difference between followin intialization....
int iVar1 does not initalize the iVar1. Its C style of declation of integer.
whereas in C++ everything is implemented using classes even basic built-in data types.
int iVar2 int();
so int() is nothing but constructor that creates one object of int type and assigned to iVar2. (means assignment operator is overloaded). try int(5)... i.e.