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

hello friends, given an expression we have to remove the unwanted brackets in that expression. Eg : (a+b) ---> a+b (a+b)*(c)-----> (a+b)*c. Please mail me if you know the logic. My mail id is : saravana6m@gmail.com. Thank you in advance :-)

1 Answers   GrapeCity, Microsoft,


We need to write the function to check the password entered is correct or not based on the following conditions.. a) It must have atleast one lower case character and one digit. b)It must not have any Upper case characters and any special characters c) length should be b/w 5-12. d) It should not have any same immediate patterns like abcanan1 : not acceptable coz of an an pattern abc11se: not acceptable, coz of pattern 11 123sd123 : acceptable, as not immediate pattern adfasdsdf : not acceptable, as no digits Aasdfasd12: not acceptable, as have uppercase character

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.

2 Answers   TCS,


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,


How to Split Strings with Regex in Managed C++ Applications?

0 Answers   Microsoft,






How to swap two ASCII numbers?

0 Answers  


write a program in c++ to scramble a bmp image file using a scramble key 0x7c and an XOR logic. print out the original image, the scrambled image and the program. Note: the first 24bytes of a bmp file contain the header information of the file.

1 Answers  


write a program that calculate the volume of cylinder after user enters radius and height and show the algorithm used

1 Answers   Jomo Kenyatta University,


How do I store linked list datas into an array?

1 Answers  


write a program to calculate the radius for a quadratic equation use modular programming(function abitraction)hint use quadratic function

1 Answers   ICAN, Jomo Kenyatta University,


main(){int a=5,b 10,c=2, d;a=b c;d=++a=(--c)*2; printf("%d%d%d%d,a,b,c,d; return o;}

1 Answers  


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

1 Answers   Microsoft,


Categories