Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A few questions

Status
Not open for further replies.

khushi

Programmer
Aug 12, 2002
1
US
1. What r reference variables in C++ ?
2. Is there any concept called as 'holes in structures' or is it any kind of joke or what ?
 
can you be more specific?

on #1, if you are talking about referencing a variable, that means you are not showing it's value , but instead you show it's location in the memory, thus allowing you to mess with the original value.

for more information look up pointers, * , & and memory allocation

as for the second one, the only time I can think of a structure having a "hole" is if it were part of a linked list, or some other usage of a pointer, and the the link or "reference" to that data was lost, thust creating something of a memory "leak" or "hole" meaning unrecoverable data until you reboot, it'll fill up your memory(RAMS)
Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
As to the 2nd one, the implementation is allowed to insert "padding bytes" in structures at it sees fit to solve alignment problems. Therefore, a given structure may have any number of empty bytes and the size of a given structure may be different across implementations.




Russ
bobbitts@hotmail.com
 
Example for a reference would be something like this.

int  i  = 0;
int &ir = i;   // ir is an alias for i
ir = 2;        // same effect as i = 2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top