12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

94 Day 3<br />

Exercises<br />

1. Write a program that declares a structure, dynamically creates an <strong>in</strong>stance of the<br />

structure, and fills the structure with data. (H<strong>in</strong>t: Don’t forget to delete the<br />

po<strong>in</strong>ter.)<br />

2. Modify the program from Exercise 1 to use a reference rather than a po<strong>in</strong>ter.<br />

3. Rewrite the REFERENC program <strong>in</strong> List<strong>in</strong>g 3.2 so that the mail<strong>in</strong>gListRecord<br />

structure is passed to the displayRecord() function by reference rather than by<br />

value.<br />

4. What is wrong with the follow<strong>in</strong>g function declaration?<br />

void SomeFunction(<strong>in</strong>t param1, <strong>in</strong>t param2 = 0, <strong>in</strong>t param3);<br />

5. Expla<strong>in</strong> to a five-year-old the difference between po<strong>in</strong>ters and references.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!