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

Write an algorithm that receives a string and reverses it.

2 Answers  


write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.

0 Answers   HCL, SRCASW,


Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37

0 Answers   Nagarro,


Faster Computers Suppose you have a computer that requires 1 minute to solve problem instances of size 1000. What instance sizes can be run in 1 minute if you buy a new computer that runs 1000 times faster than the old one, assuming the following time complexities T(n) for our algorithm? (a) T(n) = O(n). (b) T(n) = O(n3). (c) T(n) = O(10n).

1 Answers   Qatar University,


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.

5 Answers   ADP, Amazon, HCL, IBM, Infosys, Satyam, TCS, Vimukti Technologies,






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,


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,


Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?

0 Answers  


what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }

0 Answers  


Write a program using two-dimensional arrays that determines the highest and lowest of the 12 input values. Example: Enter 12 numbers: 13 15 20 13 35 40 16 18 20 18 20 14 highest: 40 lowest: 13

1 Answers  


Write a function- oriented to convert the input dollar(s) into its equivalent peso. Assume that one dollar is equivalent to 51.60

1 Answers  


output for printf("printf");

0 Answers  


Categories