CIS 1500 Chapter Notes - Chapter 8: Local Variable, Global Variable
Document Summary
Assigning a normal parameter fails to update an arguments variable. Happens because a normal parameters pass by value and arguments simply copy the local variable. Add *" before the variable to change it in the main function, just as you would put &" before scanning into the program. Commonly known as pass by reference but to not confuse it with c++ we use pass by pointer. Use & in main and * in all arguments in other function. Use const in front of the array to declare the amount of elements in an array to not change. An array is automatically passed as a pointer into the function. You do not need a second variable declaring the size of the array for a string array. Only use &" before a variable which is not an array or a value which isn"t already a pointer. The name of a defined variable or function item is called the scope.