In c++ ,once a reference is tied with a variable it cannot be tied with another variable but when you write a code as follows ,this statement seems false-
the code is
#include<iostream.h>
void main()
{
int i = 5;
int &j= i;
int p = 10;
j = p;
cout<<endl<<i<<endl<<j;
p = 20;
cout<<endl<<i<<endl<<j;
}
Can you have any explaination to sort it out?
I got this:
10
10
10
10
So whats ur prob?
I got this:
10
10
10
10
So whats ur prob?