Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What kind of problems can be solved by a namespace?

1134


When does the c++ compiler create temporary variables?

1085


How the delete operator differs from the delete[]operator?

1145


What are the characteristics of friend functions?

1073


Explain function overloading and operator overloading.

1121


Why are pointers used?

1051


Do we have to use initialization list in spite of the assignment in constructors?

1051


Why is standard template library used?

1104


Describe the role of the c++ in the tradeoff of safety vs. Usability?

1272


Do vectors start at 0?

1045


What do you mean by translation unit?

1132


Describe new operator?

1214


Do you know what are static and dynamic type checking?

1104


Incase of a function declaration, what is extern means?

1026


What is static class data?

1109