what is the difference between int &r and int& r

Answers were Sorted based on User's Feedback



what is the difference between int &r and int& r..

Answer / nakubu

There is no difference; C++ is pretty much whitespace
agnostic. What depends is its use:

int function(int &r)
{
...
}

is a function declaration that accepts an integer pointer as
a parameter, and:

int a = 7;
int &r = a;

will make a reference to an integer.

The spacing around the & makes no difference.

Is This Answer Correct ?    13 Yes 0 No

what is the difference between int &r and int& r..

Answer / kumar sourav

according 2 me int &r is a declaration in which address of
r is of integer datatype whereas int& r is an alias or we
can say it a reference i.e we can put any other variable
instead of r.

Is This Answer Correct ?    6 Yes 6 No

what is the difference between int &r and int& r..

Answer / shiv

according to me int &r is declaration , and int& r is
reference .

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More C++ Code Interview Questions

Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.

0 Answers   ABC, Guidance Software,


using repetition structure. Write a c program that will accept five numbers. The program should count and output the total count of even numbers and total count of add numbers.

2 Answers  


Complexity T(n) Write a linear-time algorithm that sorts n distinct integers, each of which is between 1 and 500. Hint: Use a 500-element array. (Linear-time means your algorithm runs in time c*n + b, where c and b are any constants that do not depend on n. For example, your algorithm can run in time n, or time 2n + 1, or time 5n + 10, or time 100n + 6, but not time c*n*n = c*n?.)

1 Answers   Qatar University,


write a c program, using for loop, that accepts and odds two numbers. The output must be the sum and the addens. This should be repeated 5 times while the first number is decremented by one and the second number is incremented by 1.

2 Answers   IBM, Infosys,


can we declare an object of a class in another class?(assume both class as public classes)

1 Answers   Microsoft,






How to swap two ASCII numbers?

0 Answers  


i don't know about working of nested for loop can any one help me

0 Answers  


Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.

3 Answers   TCS, Vimukti Technologies, Wipro,


what is the diffrence between ++x , x++ pleaaaaase ???

7 Answers  


#include<iostream.h> //main() //{ class A { friend class B; public: void read(); }; class B { public : int a,b; }; void A::read() { cout<<"welcome"; } main() { A x; B y; y.read(); } In the above program......, as B is a friend of A B can have access to all members,i cant access y.read . could you please tell me the reason and what would i code to execute this program?

2 Answers  


Assume in University Every student in university as entity, prepare a class for student that store the roll no, name, dob of student, and make funtion of deletion, manipulation, addition of student record.

0 Answers  


Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

0 Answers   Wipro,


Categories