Functions Flashcards Preview

Introduction to Programming > Functions > Flashcards

Flashcards in Functions Deck (10)
Loading flashcards...
1
Q

advantages of using functions

A

code isnt duplicated
we can reuse common utilities
problems can be broken up into sub problems
unit testing

2
Q

general layout for a function header

A
>return type< >function name< ()
{
  function body
}
3
Q

how to separate parameters in function lsit

A

using commas`

4
Q

which are the functions ttat everyone can see

A

public`

5
Q

3 things that can be sent into a function

A

call by value parameters
call by reference parameters
member data

6
Q

3 things that are returned from a function

A

member data
return type
call by reference parameter`

7
Q

why shouldnt you use parameters as local varibales in functions

A

because this will change the value of that parameter outside the function which may not be your intention

8
Q

can local variables in one function be acessed by code in another functoin

A

no, unless the variables are constants

9
Q

variables that are defined in the parameter list are in scope until

A

The function ends

10
Q

what is recursion

A

the calling of a function within the function itself