Free Online Flashcard Deck

05 Functions Free Online FlashCards

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

12 cards
01
Front

What does a C++ function declaration specify?

Back

A function declaration, or prototype, tells the compiler the function’s name, return type, and parameter types without providing its body.

02
Front

What is a function definition?

Back

A function definition supplies the complete implementation, including the function body and its statements.

03
Front

How do parameters differ from arguments?

Back

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

04
Front

What happens when an argument is passed by value?

Back

By-value parameters receive copies, so changing the parameter inside the function does not change the caller’s original variable.

05
Front

What can a reference parameter do?

Back

A reference parameter, such as int& value, can modify the caller’s variable directly.

06
Front

Why use a const reference parameter?

Back

A const reference avoids copying while preventing the function from modifying the referenced argument.

07
Front

What does return do in a C++ function?

Back

The return statement ends a function and can send a value back to its caller. A void function may use return; only to exit early.

08
Front

What does void mean as a function return type?

Back

A function with return type void does not return a value to its caller.

09
Front

What happens during a function call?

Back

When called, a function’s parameters are initialized from the arguments, its body executes, and control returns to the statement after the call.

10
Front

What determines a local variable’s scope?

Back

A local variable can be used from its declaration through the end of its enclosing block; it is unavailable outside that scope.

11
Front

Why can a local variable reset on every call?

Back

Each ordinary function call creates independent local variables, so a local count initialized to zero prints 1 on every call after incrementing.

12
Front

What makes two C++ functions overloads?

Back

Function overloading permits the same name for functions whose parameter lists differ in number, types, or type order.