We say Reference are const pointers. Why I am able to assign a new variable to ref B? The below prog

Posted by sandeep on Stack Overflow See other posts from Stack Overflow or by sandeep
Published on 2010-03-22T10:41:00Z Indexed on 2010/03/22 10:41 UTC
Read the original article Hit count: 223

Filed under:
#include<iostream.h>

int main()
{
int a=10;
int &b=a;

cout<<"B"<<'\n'<<b;
cout<<"A"<<'\n'<<a;
b=100;
cout<<"B"<<'\n'<<b;
cout<<"A"<<'\n'<<a;
int c=20;
b=c;

cout<<"C"<<'\n'<<c;
cout<<"B"<<'\n'<<b;
}

© Stack Overflow or respective owner

Related posts about c++