C++ Programming Question: Download C++ Programming PDF

How many ways are there to initialize an int with a constant?

Tweet Share WhatsApp

Answer:

Two.
There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.
int foo = 123;
int bar (123);

Download C++ Programming PDF Read All 120 C++ Programming Questions
Previous QuestionNext Question
What are the differences between a C++ struct and C++ class?How does throwing and catching exceptions differ from using setjmp and longjmp?