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

Is overriding possible in c++?

1021


What is c++ and its uses?

1233


Describe the syntax of single inheritance in C++?

1082


What is a singleton class c++?

1046


what is oops and list its features in c++?

1059


What is the difference between an external iterator and an internal iterator?

1112


What is a c++ class?

1107


Explain public, protected, private in c++?

1022


Where must the declaration of a friend function appear?

964


Which programming language's unsatisfactory performance led to the discovery of c++?

1337


Write a c program for binary addition of two 8 bit numbers.

4124


Why main function is special in c++?

1137


What is array in c++ example?

1120


What size is allocated to the union variable?

1070


Is c++ still being used?

1032