Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Day 5

Quiz

A1: The function prototype declares the function; the definition defines it. The prototype ends with a semicolon; the definition need not. The declaration can include the keyword inline and default values for the parameters; the definition cannot. The declaration need not include names for the parameters; the definition must.
A2: No. All parameters are identified by position, not name.
A3: Declare the function to return void.
A4: Any function that does not explicitly declare a return type returns int. You should always declare the return type as a matter of good programming practice.
A5: A local variable is a variable passed into or declared within a block, typically a function. It is visible only within the block.
A6: Scope refers to the visibility and lifetime of local and global variables. Scope is usually established by a set of braces.
A7: Recursion generally refers to the ability of a function to call itself.
A8: Global variables are typically used when many functions need access to the same data. Global variables are very rare in C++; after you know how to create static class variables, you will almost never create global variables.
A9: Function overloading is the ability to write more than one function with the same name, distinguished by the number or type of the parameters.

 


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial