what is the difference between int &r and int& r
Answers were Sorted based on User's Feedback
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 |
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 |
Answer / shiv
according to me int &r is declaration , and int& r is
reference .
| Is This Answer Correct ? | 2 Yes | 6 No |
How to swap two ASCII numbers?
write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.
i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.
Write a program to enter 10 number of integer entries into an array n and then odds up all the odd entries. the program then displays the result. plssss answer assss fast asss u can...
Definition of priority queue was given. We have to implement the priority queue using array of pointers with the priorities given in the range 1..n. The array could be accessed using the variable top. The list corresponding to the array elements contains the items having the priority as the array index. Adding an item would require changing the value of top if it has higher priority than top. Extracting an item would require deleting the first element from the corresponding queue. The following class was given: class PriorityQueue { int *Data[100]; int top; public: void put(int item, int priority); // inserts the item with the given priority. int get(int priority); // extract the element with the given priority. int count(); // returns the total elements in the priority queue. int isEmpty(); // check whether the priority queue is empty or not. }; We had to implement all these class functions.
0 Answers Nagarro, Wollega University,
write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used
0 Answers Jomo Kenyatta University,
Write a function- oriented to convert the input dollar(s) into its equivalent peso. Assume that one dollar is equivalent to 51.60
solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)
U hv to enter a range from a and b and search hw many no. of times a pattern n. occurs between the range a and b. Eg :i/p:enter range :0 100 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 0 to 100:1 Eg :i/p:enter range :100 1000 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 100 to 1000: (in this 13,113,131,132,133…139,213,313,…913 all these will be counted)
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,
Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).
what is the difference between int &r and int& r