whats the difference between int i=5 and int i(5)

Mar 16, 2010 at 5:41am
Is there any performance difference between above statement.

1
2
3
 int i = 5;

 int i(5);


Does above code contain any kind of difference ?
Please suggest.
Last edited on Mar 16, 2010 at 5:44am
Mar 16, 2010 at 7:31am
Int i = 5 ; here your declaring a variable of type integer and assigning it to 5 , int(5); your declaring a 1 d array of type integer with 6 elements or 6 storage spaces
Mar 16, 2010 at 10:42am
No. They are both the same.
1
2
int i = 5; // implicit constructor notation 
int i(5); // explicit constructor notation 

BTW this is "articles" section ( the topic was moved )
Last edited on Mar 16, 2010 at 4:16pm
Topic archived. No new replies allowed.