How many ways are there to initialize an int with a constant?
Answer / nikhil upadhyay
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);
It's acceptable when a programmer does not know about the second notation, although they should certainly know about the first one. Many old-timer C programmers who made the switch to C++ never use the second idiom, although some wise heads of C++ profess to prefer it. If your applicant is quick with the right answer, that's a good sign.
| Is This Answer Correct ? | 0 Yes | 0 No |
write a program to add two numbers without using an arithmetic operator.
To what does “event-driven” refer?
What is #include math h in c++?
What is linked list in c++?
Do vectors start at 0?
Which bitwise operator is used to check whether a particular bit is on or off?
what is oops
What is the use of bit fields in structure declaration?
What is the sequence of destruction of local objects?
What are dynamic type checking?
Write about the scope resolution operator?
What do you mean by C++ access specifiers ?