C++ Programmer Question:
Download Job Interview Questions and Answers PDF
Tell us in how many ways we can initialize an int variable in C++?
![C++ Programmer Interview Answer C++ Programmer Interview Question](https://globalguideline.com/public/images/interview/28.png)
Answer:
In c++, variables can be initialized in two ways, the traditional C++ initialization using "=" operator and second using the constructor notation.
Traditional C++ initilization
int i = 10;
variable i will get initialized to 10.
Using C++ constructor notation
int i(10);
Traditional C++ initilization
int i = 10;
variable i will get initialized to 10.
Using C++ constructor notation
int i(10);
Download C++ Programmer Interview Questions And Answers
PDF
Previous Question | Next Question |
Explain me what do you mean by translation unit in c++? | Explain me what is meant by reference variable in C++? |