Free Online Flashcard Deck

5 Functions Free Online FlashCards

Study 5 Functions with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is a C++ function?

Back

A function is a named block of code that performs a task. It supports program decomposition by dividing a large problem into smaller, focused operations.

02
Front

Declaration vs. definition

Back

A declaration introduces a function to the compiler without its body; a definition supplies the function body and specifies its behavior.

03
Front

When must a function be declared?

Back

A function declaration must be visible before a call that uses the function, unless the function definition already appears before that call.

04
Front

Parameter vs. argument

Back

A parameter is a variable listed in a function declaration or definition; an argument is the value supplied when the function is called.

05
Front

What does a function’s return type specify?

Back

The return type appears before the function name. A non-void function must return a suitable value on every path that reaches its end.

06
Front

What does return do?

Back

A return statement transfers control to the caller. With an operand, it also initializes the result of the function call.

07
Front

What is local scope in a function?

Back

Function parameters and local variables are usable only within their function or enclosing block, so they are not normally available in another function.

08
Front

What is name hiding?

Back

An inner declaration can hide a name from an enclosing scope. For example, a local value can hide a global value with the same name.

09
Front

What happens in pass-by-value?

Back

Pass-by-value gives the function its own parameter object initialized from the argument. Assigning to that parameter does not change the caller’s variable.

10
Front

Why does reset(original) leave original unchanged?

Back

Changing a pass-by-value parameter does not change the caller’s variable because the function modifies its independent parameter object.

11
Front

What is function overloading?

Back

Function overloading permits functions in the same scope to share a name when their parameter lists differ in number or types.

12
Front

Can return types alone overload functions?

Back

The return type alone cannot distinguish overloads. Two functions with identical parameter lists but different return types are invalid overloads.