Question
How to create a reference variable in c++?

Answers

Appending an ampersand (&) to the end of datatype makes a variable eligible to use as reference variable.int a = 20;int& b = a;The first statement initializes a an integer variable a. Second statement creates an integer reference initialized to variable a Take a look at the below example to see how reference variables work.int main (){ int   a; int&  b = a; a = 10; cout << "Value of a : " << a << endl; cout << "Value of a reference (b) : " << b  << endl; b = 20; cout << "Value of a : " << a << endl; cout << "Value of a reference (b) : " << b  << endl; return 0;}Above code creates following output.Value of a : 10Value of a reference (b) : 10Value of a : 20Value of a reference (b) : 20   Your Comment




More Software Questions..
What is the inputsplit in map reduce software?

What is software configuration management?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?

What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?

Which oracle package is used to manage the oracle lock management services?

What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?

What is marker interface?

What types of partitioning are there for BW?



Search
Can you Answer!!
  • Q Gautama Buddha was elevated to the position of God by the time of_
  • Q Write notes on the following Animal collection
  • Q how you will set the permissions for different subject areas
  • Q What is a status 1015 in Betrieve?
  • Q What is cardiac plexus
  • Q What do you know about Pay Pal?
  • Q Where can I get official information for federal payroll taxes?
  • Q ___________ is an e-Commerce solution of National Payments Corporation of India (NPCI)?
  • Q The period mentioned in the autobiography of Mahathma Gandhi is from childhood to:
  • Q How does biological diversity relate to the characteristics of the abiotic factors of an ecosystem?
  • Q How do you create table alias in OBIEE