Initializing variables while writing a program is one of the most basic routines that a programmer does while writing the code. Normally it is done using the assignment operator '=' and initializing the variable.
E.g
E.g
int x = 5;
// this initializes the value of x with 5
But i found out that it could also be done this way,
int x(5); // this initializes the variable with the value 5
This is called constructor initialization, though it is not widely used, I thought it would be a good idea to know.
Initializing the variable using this method has no advantage, so its not necessary. Just remember that it can also be done this way.
0 comments:
Post a Comment
Comment Here....