reference in function

Hello, I have:

1
2
3
4
  ...
 int a=rand();
int b=rand();
int& c=a*b;


and here are problems with declaration (because of the reference)

I tried:

1
2
3
4
int a=rand();
int b=rand();
int c=a*b;
int &x=c;


And there was error wrong int* to int

Please , how to solve this?
http://www.cplusplus.com/doc/tutorial/pointers/

1
2
3
4
int a = rand();
int b = rand();
int c = a*b;
int *x = &c;//int pointer x = address of c 
Topic archived. No new replies allowed.