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 |
What is "mutable" keyword?
What does new return if there is insufficient memory to make your new object?
List out some of the OODBMS available?
What does it mean to declare a member variable as static?
What does n mean in c++?
Mention the purpose of istream class?
Describe run-time type identification?
Does defining a function inline mean that it wont push and pop things on/off the stack ...like parameters and the return the address??
Write a c program for binary addition of two 8 bit numbers.
Write any small program that will compile in "C" but not in "C++"?
What is #include c++?
What is the full name of logo?