How many ways are there to initialize an int with a constant?
Answer Posted / 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 |
Post New Answer View All Answers
What data encapsulation is in c++?
What is a lambda function c++?
How the delete operator differs from the delete[]operator?
Is swift faster than c++?
Why is c++ called oops?
List the special characteristics of constructor.
A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.
Mention the ways in which parameterized can be invoked. Give an example of each.
Explain selection sorting. Also write an example.
What is the latest c++ standard?
When are exception objects created?
Which should be more useful: the protected and public virtuals?
Write a recursive program to calculate factorial in c++.
What is object oriented programming (oop)?
Is c++ a programming language?