Programming with Passion

Make the best out of everything.

Friday, 8 April 2016

In how many ways we can initialize an int variable in C++?

 In how many ways we can initialize an int variable in C++?
In c++, variables can be initialized in two ways, the traditional C++ initialization using "=" operator and second using the constructor notation.
  • Traditional C++ initilization
  1. int i = 10;
variable i will get initialized to 10.
  • Using C++ constructor notation
  1. int i(10);

No comments:

Post a Comment