Functions and Parameters C++ - Reading Assignment


1. What is a function parameter? They are values that passed into functions
2. Why do functions need parameters? Functions do not necessarily need parameters, but if you want to get something back from the function, after passing the function a value, then it will need parameters to work with.


1. What is a function parameter?
A variable which is used within a function.
2. Why do functions need parameters?
Functions need parameters so that data can be passed to them for use.

  1. A function paramater is an input to the function. The function can use this parameter to do some functionality/operation and possibly return a value to the main program execution.

  2. Parameters are NOT mandatory for functions. However when parameters are used they do allow a program to be written with more flexibility and efficiency because the function can be called multiple times to perform the same functionality but with different inputs from the main point of execution.


1- Parameters are variables created to allow the functions to work with different values passed to them (arguments).
2- Functions need parameters because it allows them to work with different values every time they are called, making them more flexible, and decreasing the need to rewrite multiple functions to do similar work with different values.

  1. A function parameter is a local variable used when calling the function (it is an input)
  2. Because functions have to return values that are the result of input processing