dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++
Expertise: Beginner
Nov 14, 2000

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


References

Question:
I want to know if the following declaration is possible:

int *p;
p= new int;
int &refval= *p;

Answer:
It's valid C++. You're binding a reference to an l-value of type int. Thus, refval becomes an alias of *p.

DevX Pro
 
Thanks for your registration, follow us on our social networks to keep up-to-date