15,500,921 members
See more:
C#
```#include<iostream>
#include<conio.h>
using namespace std;

void AAA (int* & x,int *y)
{
cout<<y<<endl;
cout<<x<<endl;
}
void main()
{
int x=5;
int *y=&x;

AAA(y,y);
getch();

}```

what is mean both of { int* & x,int *y }
Posted
Sergey Alexandrovich Kryukov 17-Oct-12 15:51pm
This is not a productive way of asking questions. Better develop your own code based on reading manuals, show it if you stuck. --SA

## Solution 1

int * is a pointer to a memory address that contains an int. int * y = &x means x and y are both the SAME int instance only one int is created here. However, its also the one pointer being passed twice, because you pass y twice, the x and y in AAA are both the y in your main, because that's what you passed in.

main always returns int in valid C++

Anderso0on 4-Aug-12 0:39am
but what is different between int* & x,int *y ?????
Christian Graus 4-Aug-12 0:43am
&x means, the address of x. If x is an int, &x is an int *. int * y = &x means, declare a pointer to an int, called y, and set it's value to be the address of the int, x. You should probably talk to your teacher if you're confused, we're happy to help, but if you're not getting my answers, your teacher can help better.
_Amy 4-Aug-12 12:04pm
Nicely explained. +5!
Anderso0on 4-Aug-12 0:49am
thanks alot
BillW33 6-Aug-12 9:21am
Good explanation, +5

## Solution 2

Pointer declarations are better off to be read from right to left for better understanding!!
int* & x is a reference to a pointer to an int
int *y is a pointer to an int

http://stackoverflow.com/questions/5789806/meaning-of-and-in-c[^]
http://stackoverflow.com/questions/4185776/what-does-mean-in-a-function-parameter[^]
http://stackoverflow.com/questions/57483/what-are-the-differences-between-pointer-variable-and-reference-variable-in-c[^]

BillW33 6-Aug-12 9:21am
Nice references, +5
Volynsky Alex 6-Aug-12 9:56am
Thanks CIDev!
Amarnath S 7-Aug-12 7:34am
Is there a way to bookmark your solution? I'd like to bookmark it.
BillW33 7-Aug-12 9:31am
@Amarnath, To bookmark a solution click the icon that looks like a star with a plus sign at the bottom right of the solution.
Amarnath S 8-Aug-12 12:29pm
@CIDev, thanks. Somehow, I missed that star icon amidst all the contents of this page. I was looking for it at the top, and it is in the bottom.