Both are temporary variables that exist only while the function is executed. That is, both are allocated when the function begins executing and are deallocated when the function terminates. Within the function, parameters and local variables take precedence over any external variables of the same name. For example, if you have assigned a variable x a value outside of a function, and then use x as the name of a parameter or local variable inside the function, then any reference to x inside the function will refer to the parameter or local variable. It is important to remember that parameters and local variables serve different purposes, though.
Parameters represent values that are passed in to the function via arguments.
These variables are automatically assigned values corresponding to the arguments when the function is called. Local variables, on the other hand, are not given values from outside the function. They are completely isolated inside the function, serving as temporary storage while the function executes. Previous exercises demonstrated the danger of not declaring a variable inside a function to be local. If the variable is not declared to be local, then any external variable with the same name will be affected by the function.