Login | Register   
Twitter
RSS Feed
Download our iPhone app
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

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
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap