Engineering Science 1036A/B Lecture 19: Pointers: Pointers and Functions

27 views2 pages
A pointer can be used in the formal parameter list of a function
void mySwap(int *x, *y)
When a function is called, the associated addresses must be passed to the
function through the argument list
int a(5), b(6); mySwap(&a, &b);
A pointer parameter must be explicitly de-referenced to access the contents at
that address
Call By Reference
The function is called by reference, because the pointer in the formal parameter
list can only be activated (initialized to be used) by a variable that contains an
address of an existing variable
Call by reference using pointers method 1
Call by reference using pointers method 2
Pointers and Functions
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

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

Related Questions