Chapter 4


1.

How do you prototype a function?

simply place its declaration line at the beginning of your code just after the include statements, and follow it with a semicolon.

2.

What are parameters?

data that you pass to the function when you call it

3.

What are the four rules for writing a function?

the function must have a return type. it may be void if the function returns nothing. the function must have a valid name. the function must have parentheses for a list of parameters past to it, even if the parentheses are empty. the function must either be written before it s called, or it must be prototyped.

4.

How many parameters may a function have?

none, one, or many

5.

What is another word for the parameters of a function?

arguments

6.

What is function overloading?

having more than one function with the same name but different types or a different number of parameters.

7.

What is one purpose of header files?

storing function prototypes

8.

What extension do header files end in?

.h

9.

Can an overloaded function have the same number of parameters?

yes, if they are of different types.

10.

What is passing by reference?

this is when you pass an address of a variable to a function, rather than the value contained by that variable.

Answers

1.

Simply place its declaration line at the beginning of your code just after the include statements, and follow it with a semicolon.

2.

Data that you pass to the function when you call it

3.

The function must have a return type. It may be void if the function returns nothing.

The function must have a valid name.

The function must have parentheses for a list of parameters past to it, even if the parentheses are empty.

The function must either be written before it’s called, or it must be prototyped.

4.

None, one, or many

5.

Arguments

6.

Having more than one function with the same name but different types or a different number of parameters.

7.

Storing function prototypes

8.

.h

9.

Yes, if they are of different types.

10.

This is when you pass an address of a variable to a function, rather than the value contained by that variable.




C++ Programming Fundamentals
C++ Programming Fundamentals (Cyberrookies)
ISBN: 1584502371
EAN: 2147483647
Year: 2005
Pages: 197
Authors: Chuck Easttom

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net