As mentioned previously, the parameter of the function is a local variable. This is why calling the three statements that are commented in the code will cause an error. The variables sum
, array
, and counter
don't exist in the global level and will be hidden from the program if it is called outside the function. The function and the variable arr
are the only two variables that are in the global scope and can be called anywhere in the program.