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...

What is the output of:

String a1 = "Hello";
String a2 = "world!";
String* s1 = &a2;
String& s2 = a1;
s1 = &a1;
s2 = a2;
std::cout << *s1 << " " << s2 << std::endl;

Answer Posted / ratan

The output is

world! world!

This is becuase s2 is a reference variable of a1 and we are
assigning s2 value if a2 which is world!.

This is chnaging the value at a1 as well.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the concept of dynamic allocation of memory?

1152


What is a forward referencing and when should it be used?

1210


Why can templates only be implemented in the header file?

1142


Do you need a main function in c++?

1166


What is difference between n and endl in c++?

1143


What is late binding c++?

1030


Const char *p , char const *p What is the difference between the above two?

1254


Are c and c++ different?

1029


Why is that unsafe to deal locate the memory using free( ) if it has been allocated using new?

1121


What is class invariant in c++?

1278


Is swift faster than go?

1138


What is c++ hiding?

1299


Differentiate between C and C++.

1322


Explain how the virtual base class is different from the conventional base classes of the opps.

1210


What is array give example?

1107