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

What is scope resolution operator in c++ with example?

1037


What are enumerations?

1106


What is null and void pointer?

1062


Can create new c++ operators?

1030


Name the debugging methods that are used to solve problems?

1085


What are the vectors in c++?

1033


What is the maximum value of a unsigned char a) 255 b) 256 c) 128

1073


What is constructor c++?

1119


What happens when you make call 'delete this;'?

1088


Difference between a homogeneous and a heterogeneous container

1142


Which compiler does turbo c++ use?

1078


What is the most useful programming language?

1049


How do I run c++?

1070


Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.

1117


Is c++ still being used?

1027