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 |
the first character in the variable name must be an a) special symbol b) number c) alphabet
What is the use of function pointer?
How the compilers arranges the various sections in the executable image?
What causes a runtime error c++?
What is a catch statement?
What are the different types of polymorphism in c++?
how many trys can we write in one class
How can you quickly find the number of elements stored in a dynamic array?
What is istream and ostream in c++?
Explain what are single and multiple inheritances in c++?
When do we use copy constructors?
Can circle be called an ellipse?