Tech News

What is the difference between reference and pointer?

A pointer can have Null value ,int *p=Null means, it is not having any address to point . while reference can’t have &p=Null(not allowed).

2- address can be changed in case of pointer while in case of reference it can’t b. 

int a=10;
int *p =&a,
int b=30;

int *p=&b; valid now, but in reference it’s not possible.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x