Computer Science 1037A/B Lecture Notes - Lecture 2: Hard Coding, Global Variable, Memory Address

7 views2 pages

Document Summary

Just as you can pass single values to a function, you can also pass an entire array to a function. Normally when you pass an array to a function, you should also pass its size in another argument so that the function knows how many elements are in the array. Otherwise, you will have to hard code this into the function or declare it in a global variable. There are important differences between passing the values of variables of primitive data types and passing arrays: For an argument of a primitive type, the argument"s value is passed. For an argument of an array type, the value of the argument is the starting memory address to an array this value is passed to the array parameter in the function (pass by sharing) Passing an array variable means that the starting address of the array is passed to the formal parameter.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions