CIS 1500 Chapter Notes - Chapter 8: Local Variable, Global Variable

45 views1 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents