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

Which coding certification is best?

1010


How delete [] is different from delete?

1002


Explain terminate() and unexpected() function?

1089


Can we use this pointer in a class specific, operator-overloading function for new operator?

1095


Explain the virtual inheritance in c++.

1053


What is the best free c++ compiler for windows?

1099


What problems might the following macro bring to the application?

1037


Is c++ still being used?

1021


What is the difference between prefix and postfix versions of operator++()?

1072


Can we sort map in c++?

1012


Mention the purpose of istream class?

1101


What is vector string in c++?

1072


Can comments be longer than one line?

1061


Which software is used for c++ programming?

1077


What is increment operator in c++?

1014